18 days ago
Hello,
I'm trying to have Sim Studio AI fully operational and properly set.
It appears that I can not get it fully working.
For example, I'm not able to save LLM API keys.
I see a list of errors over Google Chrome Console, as:
GET https://simstudio-production-5e77.up.railway.app/api/auth/organization/get-full-organization 404 (Not Found)
GET https://simstudio-production-5e77.up.railway.app/api/auth/organization/list 404 (Not Found)
and after clicking the 'Save' button, I get:
PUT https://simstudio-production-5e77.up.railway.app/api/workspaces/0d586f1d-3b51-4ca5-9381-c1385a8aebe9/environment 500 (Internal Server Error)
• What is the root cause?
• How to fix this?
Thank you very much,
Vince
3 Replies
18 days ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • 18 days ago
18 days ago
There is something not properly set about this installation or deployment. This issue is not about Sim AI itself. What can be such an issue?
18 days ago
Here you go:
The errors point to two distinct problems with your Railway deployment:
- The 404s on /organization/ routes
These routes aren't being found on your instance. This typically happens because:
NEXTAUTH_URL is pointing to the wrong address
The app can't initialize the organization module due to missing configuration
- The 500 on PUT /environment
This is the critical error. A 500 when saving to the database almost always means:
DATABASE_URL is not set or is incorrect in Railway
Database migrations were not run after the deploy
The database service (PostgreSQL) is not properly linked to the app
How to fix it step by step:
In Railway, go to your service → Variables tab and confirm these environment variables exist:
DATABASE_URL (should point to your internal Railway PostgreSQL)
NEXTAUTH_SECRET (a long random string)
NEXTAUTH_URL (e.g. https://simstudio-production-5e77.up.railway.app)
If the database is connected but migrations were never run, open the service terminal in Railway and execute:
npx prisma migrate deploy
(or the equivalent for whatever ORM Sim Studio uses)
After adjusting the variables, trigger a new deploy — environment variable changes do not apply to the currently running container.
After the redeploy, check Railway → Logs and look for any database connection errors on startup.
The 404s on the organization routes will likely disappear once the database is properly set up, since those modules depend on a valid session which requires a working database connection.
18 days ago
Another strong indicator here is that:
One additional clue here is that the frontend itself is clearly working the UI loads and API requests are being attempted so this is likely not a Railway networking issue.
The failure pattern points more toward a partially initialized backend state:
- auth/organization routes returning 404
- environment save endpoint returning 500
- workspace APIs failing
That combination usually happens when:
- Prisma/client generation failed
- migrations were skipped
- the database schema is incomplete
- or required environment variables were missing during the first boot
In many Next.js + Prisma deployments, the app can still start even when the database layer failed during initialization, which creates exactly this kind of “UI works but core APIs fail” behavior.
I would especially verify:
- Prisma migrations completed successfully
- prisma generate ran during build
- DATABASE_URL resolves internally from Railway
- NEXTAUTH_URL exactly matches the deployed Railway domain
- no startup errors are hidden earlier in the deploy logs
