R
Railwayβ€’2y ago
seb1

Strapi failing when deployed from the template

Is there possibly a bug? When I go to url.com/admin, it shows An error occurred while requesting the API Any idea what could be wrong? I did not change anything.
29 Replies
Percy
Percyβ€’2y ago
Project ID: N/A
seb1
seb1β€’2y ago
N/A
Percy
Percyβ€’2y ago
You might find these helpful: - Noco DB - 500 error on api call nextjs - laravel api broken
⚠️ experimental feature
seb1
seb1β€’2y ago
Some modules in build are even throwing errors.
Adam
Adamβ€’2y ago
Going to need to see those errors + the repo if public + the project ID
seb1
seb1β€’2y ago
Well the weird thing is that there are no errors in deploy logs.
seb1
seb1β€’2y ago
In the xx.com, the Strapi is running ok
seb1
seb1β€’2y ago
seb1
seb1β€’2y ago
But when opening the /admin route, I get this error.
seb1
seb1β€’2y ago
seb1
seb1β€’2y ago
... even though it literally says 200... πŸ˜„
seb1
seb1β€’2y ago
The repo, there's not much to see, it's the forked (autogenerated) template from Railway when you select Strapi.
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
seb1
seb1β€’2y ago
Happy to hear I'm not the only one.
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
seb1
seb1β€’2y ago
Alright, that looks okay But still... πŸ˜„ so you just manually create a service from a Github repo?
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
seb1
seb1β€’2y ago
@cq connect ECONNREFUSED 0.0.0.0:5432 When starting the server, it's showing this, any idea why? My PostgreSQL setup was apparently wrong. It's up and running, but I need a develop env. Why does it run in production when I literally started with npm run develop ? :D
seb1
seb1β€’2y ago
Finn
Finnβ€’2y ago
NODE_ENV is probably set to production
seb1
seb1β€’2y ago
Yes, that was the reason, thanks. Any idea why the whole database (all collections and everything) is wiped after redeploying? When it's running on dev mode and I redeploy, (to dev again) for some reason, it deletes the created collection. For this example, I want to be running dev env even in the final use, because of the collections creating and so on.
Finn
Finnβ€’2y ago
are you using sqlite
seb1
seb1β€’2y ago
No, PostgreSQL
Finn
Finnβ€’2y ago
not sure then it shouldnt be getting wiped maybe your migrations are nuking everything?
seb1
seb1β€’2y ago
I'm investigating it a bit more now I don't know, but in case they might, I really don't want them to do that :D Yes, when I redeploy the service, the postgresql table with the "Single type" I added in the Strapi admin panel suddenly disappears.
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
seb1
seb1β€’2y ago
Yes, thank you, I managed to get it working... but what a hassle, argh!
endymion1818
endymion1818β€’2y ago
Thanks everyone you also helped me to get my environment working, although I took a slightly different track because I wanted to continue to use the Railway template, and to dockerize it so I could also run it locally. So after deployment I cloned the repo, used https://github.com/strapi-community/strapi-tool-dockerize and added the environment variables that were generated in the Railway deployment. In this case I couldn't parse the connection string so I had to supply the environment variables to the config file directly as shown in the screenshot. As an aside I do think I have an unused container running postgres somewhere but I'll sort that out.
GitHub
GitHub - strapi-community/strapi-tool-dockerize: Easy add support f...
Easy add support for docker to your strapi project - GitHub - strapi-community/strapi-tool-dockerize: Easy add support for docker to your strapi project
endymion1818
endymion1818β€’2y ago
If anyone is bumping into an error that has something to do with charAt , the answer is here https://forum.strapi.io/t/could-not-load-js-config-file-config-database-js-cannot-read-property-charat-of-undefined/1630/7
Strapi Community Forum
Could not load js config file config/database.js: Cannot read prope...
@akramaskar You saved my life maaaaan! πŸ’™