W
Wasp3w ago
NEROX

Railway deployment crashed

rootall@Nerox-LpTp:~/app/.wasp/build$ railway up > Select a service server Indexed Compressed [====================] 100% Uploaded Using Detected Dockerfile ========================= context: tqr6-Q [internal] load build definition from Dockerfile [internal] load build definition from Dockerfile [internal] load build definition from Dockerfile [server-production 8/8] WORKDIR /app/.wasp/build/server [auth] sharing credentials for asia-southeast1.registry.rlwy.net [auth] sharing credentials for asia-southeast1.registry.rlwy.net importing to docker importing to docker Build time: 17.33 seconds Deploy complete > prisma migrate deploy --schema=../db/schema.prisma Prisma schema loaded from ../db/schema.prisma Datasource "db": PostgreSQL database Error code: P1012 --> /app/.wasp/build/db/schema.prisma:3 | 2 | provider = "postgresql" 3 | url = env("DATABASE_URL") [Context: getConfig] Prisma CLI Version : 5.19.1 npm notice New major version of npm available! 9.6.4 -> 11.4.0 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.4.0> npm notice Run npm install -g [email protected] to update! npm notice > [email protected] start-production > npm run db-migrate-prod && NODE_ENV=production npm run start > [email protected] db-migrate-prod > prisma migrate deploy --schema=../db/schema.prisma Prisma schema loaded from ../db/schema.prisma Datasource "db": PostgreSQL database Error: Prisma schema validation - (get-config wasm) Error code: P1012 error: Environment variable not found: DATABASE_URL. --> /app/.wasp/build/db/schema.prisma:3 | 2 | provider = "postgresql" 3 | url = env("DATABASE_URL") | Validation Error Count: 1 [Context: getConfig] Prisma CLI Version : 5.19.1 Deploy crashed
15 Replies
kapa.ai
kapa.ai3w ago
Hi @NEROX. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Your Railway deployment is crashing because the DATABASE_URL environment variable is missing. This is a required environment variable that Prisma needs to connect to your PostgreSQL database. How to fix it: You need to set up the required environment variables in Railway: 1. Go to the Railway dashboard 2. Open the Settings and navigate to the Variables tab 3. Add the following required environment variables: - DATABASE_URL - click "Variable reference" and select DATABASE_URL (it will populate with the correct value) - WASP_WEB_CLIENT_URL - enter your client domain (e.g., <https://client-production-XXXX.up.railway.app>) - WASP_SERVER_URL - enter your server domain (e.g., <https://server-production-XXXX.up.railway.app>) - JWT_SECRET - enter a random string at least 32 characters long These environment variables are required for your Wasp app to run properly on Railway, as documented in the Wasp deployment docs for Railway. If you're using any external authentication methods (like Google or GitHub), you'll also need to set the environment variables specific to those methods. Alternative temporary solution: As a temporary workaround, you could run the deploy command with the DATABASE_URL inline, as mentioned by a community member:
DATABASE_URL="<your_database_url>" wasp deploy fly launch <app_name>
DATABASE_URL="<your_database_url>" wasp deploy fly launch <app_name>
However, this is considered a hack and not the recommended approach. The proper solution is to set the environment variables in the Railway dashboard. Hope this helps resolve your deployment issue! Microsoft: This document has been generated by an AI language model. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
NEROX
NEROXOP3w ago
@kapa.ai Mention to:
Go into the Railway dashboard and set up the required env variables: Open the Settings and go to the Variables tab: - click Variable reference and select DATABASE_URL (it will populate it with the correct value)
It doesn't populate for me. I went to the Railway Postgres db > Data > Connect and it shows me:
Connect to Postgres Private Network Public Network 1. 1 Create a new variable in the service you want to connect to this database.
2. 2 Assign it the following value:
${{ Postgres.DATABASE_URL }}

${{ Postgres.DATABASE_URL }}


3. 3 Use the variable in your application code.
And I put that in the variables of the server project settings as DATABASE_URL but still crashing
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I see the issue you're having with setting up the DATABASE_URL in Railway. Let's clarify how to properly connect your Wasp app to the Railway PostgreSQL database. Correct way to reference the PostgreSQL database in Railway When setting up the DATABASE_URL variable in your server service, you need to use Railway's variable reference syntax correctly: 1. In your server service's Variables tab, create a new variable named DATABASE_URL 2. For the value, you should use exactly: ${{Postgres.DATABASE_URL}} - Make sure there are no extra spaces - The syntax is case-sensitive - The double curly braces are important If you're still experiencing issues after setting this up correctly, here are some troubleshooting steps: 1. Make sure your PostgreSQL database service is properly deployed in Railway 2. Verify that both your server service and PostgreSQL database are in the same Railway project 3. Try redeploying your server after setting the environment variable Alternative approach If the variable reference isn't working, you can also copy the actual connection string: 1. Go to your PostgreSQL service in Railway 2. Navigate to the Variables tab 3. Find the DATABASE_URL variable and copy its actual value 4. Paste this value as the DATABASE_URL in your server service's Variables tab This should resolve the deployment issue. If you continue to experience problems, you might want to check the Railway logs for more specific error messages that could provide additional clues. Microsoft: This document has been generated by an AI language model. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Carlos
Carlos3w ago
@miho has been experimenting with Railway recently, maybe he can help?
miho
miho3w ago
Please take a screenshot of your env variables panel in Railway (blur any sensitive data) so I can see what's going on
miho
miho3w ago
Like smth like that for me
No description
NEROX
NEROXOP3w ago
I see that you are in other place?
No description
NEROX
NEROXOP3w ago
ps: why yours is ${{pgvector.DATABASE_URL}} ? I'm also using the pgvector extension in my Wasp app db. Should something be different?
miho
miho3w ago
miho
miho3w ago
You should edit the variables in your server app AFAIK
NEROX
NEROXOP3w ago
Ok, put the vars in the server app fixed that issue. Now it gives me an: Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432" Error: P3009 migrate found failed migrations in the target database, new migrations will not be applied. > [email protected] start-production > npm run db-migrate-prod && NODE_ENV=production npm run start > [email protected] db-migrate-prod Prisma schema loaded from ../db/schema.prisma Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432" Error: P3009 The 20250519100901_ migration started at 2025-05-19 10:49:27.832025 UTC failed Inside the postgress app it created just a _prisma_migrations table. One entry: A migration failed to apply. New migrations cannot be applied before the error is recovered from. Database error code: 0A000Database error:ERROR: extension "vector" is not availableDETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.HINT: The extension must first be installed on the system where PostgreSQL is running.DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E0A000), message: "extension \"vector\" is not available", detail: Some("Could not open extension control file \"/usr/share/postgresql/16/extension/vector.control\": No such file or directory."), hint: Some("The extension must first be installed on the system where PostgreSQL is running.") @kapa.ai
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I see the issue now. The error is related to the PostgreSQL vector extension that's required for your application but isn't available on Railway's PostgreSQL instance. The Problem Your migration is failing because your Prisma schema is trying to use the pgvector extension, but this extension isn't installed on Railway's PostgreSQL instance. The specific error is:
ERROR: extension "vector" is not available
DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.
ERROR: extension "vector" is not available
DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.
Solutions There are a few ways to handle this: Option 1: Use a database provider that supports pgvector Railway's standard PostgreSQL doesn't have the vector extension installed. You could: 1. Use Supabase instead, which supports pgvector out of the box 2. Use a dedicated vector database like Pinecone As mentioned in the Wasp GitHub issues:
"it may be best to perform all embeddings operations on a dedicated vector database such as Pinecone using their SDK" GitHub Issue #1215
Option 2: Modify your Prisma schema If you don't absolutely need the vector extension right now, you could: 1. Remove the pgvector extension from your Prisma schema 2. Use a different approach for storing embeddings temporarily 3. Deploy successfully first, then work on adding vector support Option 3: Contact Railway support You could contact Railway support to see if they can enable the pgvector extension for your PostgreSQL instance, though this might not be possible with their standard offering. Next Steps The most straightforward solution is to modify your Wasp app to not require the pgvector extension for now. This would involve: 1. Removing the pgvector extension configuration from your app's database configuration 2. Updating any models that use vector types to use a different approach temporarily 3. Redeploying your application Once your app is deployed successfully, you can explore better options for vector storage, such as using Supabase or a dedicated vector database. Would you like more specific guidance on how to modify your Wasp configuration to remove the pgvector dependency? ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho3w ago
You need to use the pgvector template a not a vanilla PostgreSQL database
No description
NEROX
NEROXOP3w ago
✅ Deployed! Thank you very much:wizardboi:
miho
miho3w ago
Sweet, I'm glad it worked out 🙂

Did you find this page helpful?