Hello
I’ve been using strapi for quite a while but only on self hosted systems and for smaller projects.
I now want to host a Strapi-App on Google App Engine and using a MySQL-Database but I don’t seem to be able to quite do so. I followed the guide as close as possible and I think I’m very close but even after looking through several logs and googleing for hours I don’t seem to be able to fix it.
The “front-page” of strapi shows up perfectly stating “The server is running successfully.” and showing the environment as “Production” but as soon as I try to access /admin I get the error:
“Warning: An error occurred while requesting the API”
The Strapi-Server doesn’t seem to log anything according to the Google App Engine Logs, but the Borwser shows me an axios-error. It seems that axios tries to call a GET function on localhost:1337. That seems to be the error but I don’t know why and how to fix it.
Sorry for the unrelated question, but why is your path /config/env/production/database.js while mine is /config/database.js, does that matter on Strapi 4.4.5?
You can use different config files for different environments.
If you have the file for example: /config/database.js it will be loaded every time. If you have it in /config/env/production/database.js it will be loaded when you run in production.
This way you can have a different database for production and development. I use SQLite in development and MySQL in productin for example.
Oh I see, makes sense. Yeah, I was wondering if that was part of the issue that I have as well. I actually can’t even connect to the DB. Have Cloud SQL Admin enabled, using a Postgres DB.
Did you experience this issue before?
Building your admin UI with development configuration...
Admin UI built successfully
[2022-12-07 20:04:45.755] debug: \u26d4\ufe0f Server wasn't able to start properly.
[2022-12-07 20:04:45.756] error: connect ENOENT /cloudsql/project:region:db/.s.PGSQL.5432
Error: connect ENOENT /cloudsql/project:region:db/.s.PGSQL.5432
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
Thank you for taking the time to go over that, Lukas. Not too many info on this out there. And sorry for not being of much help in regards of your post.
I forgot to add the "gcp-build": "strapi build" to the scripts in the package.json which stopped google app engine from building the app after deployment.