Internal server error, cannot list posts

I am upgrading from 2.0.2 to 3.0.3 the installation it was all fine, but I have an Error 500 Invalid flags supplied to RegExp constructor 'gs' in my frontend.

And in my Admin I have this warning:

If I delete all content in the Labs section, the site, it’s ok without my content (posts), but If I import all my stuff again, the error/warning comes back, and my frontend goes down.

I don’t know what to do to preserve my content from my previous ghost installation. Thank you for your help!! :slight_smile:

  • URL https://ivanrobles.pro/
  • Ghost v3.0.3
  • Ubuntu 18.04, Nodejs v10.13.0
  • All browsers
  • Error 500 Invalid flags supplied to RegExp constructor 'gs'
  • Just upgrade from 2.0.2 to 3.0.3 or export your content from 2.0.2 and import to 3.0.3.

Ok, I solve the problem (kind of there are still issues).

I went through logs using the command ghost log tracing the errors and the file causing of not listing posts-error was in ghost/versions/3.0.3/node_modules/@tryghost/url-utils/lib/utils/html-relative-to-absolute.js in line 115:

const regex = new RegExp(`<[a-zA-Z][^>]*?(${name}=['"](${escapeRegExp(originalValue)})['"]).*?>`, 'gs');

I just removed the flag s in the 'gs' parameter.

The thing is my site responding not very well, suddenly it has error 502, or sometimes the styles arent load, or in other cases, it has error 503.

Ugh, it looks like there’s a node version incompatibility with the dotAll regex flag :disappointed:

The s flag looks like it’s only supported in node 8 when it’s run behind the harmony flag. Not sure why our tests didn’t catch it :thinking: In any case I’ll open an issue.

I just removed the flag s in the 'gs' parameter.

That will break the code - it relies on the regex behaviour that the s flag turns on.

  • Ubuntu 18.04, Nodejs v10.13.0

Can you double check this? If Ghost is really running under node 10.13.0 you shouldn’t be seeing this error :confused:

I’ve done a bit more testing and can confirm that new RegExp('.*', 'gs') works fine in Node 8.x without running behind the harmony flag.

However, if I try with Node 6.x it does fail with the error message that you’ve provided.

Please check the node version that you are running Ghost under - note that if you’ve used nvm or similar then using node --version after logging in via ssh may not give you the correct information.

Hi, Kevin, I had NVM but I don’t know why it was using A node v8.* (apt node instead of NVM node v10* ghost said that I was using v10*), so I removed nvm and other node instances installed in my server, then I installed directly via apt-get Node v10.17.

So, I have new issues :sweat_smile:
If I execute $ ghost start in the part of Starting Ghost never start!
If I do $ ghost run that is just for debugging my site works very well but I have the next warning:

WARN Can't connect to the bootstrap socket (localhost 8000)

So the next thing that I did was removing the following lines from config.production.json:

"bootstrap-socket": {
  "port": 8000,
  "host": "localhost"
}

It didn’t work.

Also, I tried to install node 10x again:

And it didn’t work again. :pleading_face: