Railway deploy server code fails with ENOENT error, following opensaas and wasp lang docs
I am getting this error when deploying to Railway by following 16.0 docs:
✔ Generated Prisma Client (v5.19.1) to ./../../../node_modules/@prisma/client in 295ms
Start by importing your Prisma Client (See: http://pris.ly/d/importing-client)
Tip: Want to turn off tips and other hints? https://pris.ly/tip-4-nohints
[server-builder 10/11] RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma' ✔ 2s
[server-builder 11/11] RUN cd .wasp/build/server && npm run bundle
[email protected] bundle rollup --config --silent[!] Error: Could not load /app/.wasp/out/sdk/wasp/dist/server/index.js (imported by src/server.ts): ENOENT: no such file or directory, open '/app/.wasp/out/sdk/wasp/dist/server/index.js' Error: Could not load /app/.wasp/out/sdk/wasp/dist/server/index.js (imported by src/server.ts): ENOENT: no such file or directory, open '/app/.wasp/out/sdk/wasp/dist/server/index.js' ✕ [server-builder 11/11] RUN cd .wasp/build/server && npm run bundle process "/bin/sh -c cd .wasp/build/server && npm run bundle" did not complete successfully: exit code: 1 Dockerfile:42 ------------------- 40 | RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma' 41 | # Building the server should come after Prisma generation. 42 | >>> RUN cd .wasp/build/server && npm run bundle 43 | 44 | ------------------- ERROR: failed to solve: process "/bin/sh -c cd .wasp/build/server && npm run bundle" did not complete successfully: exit code: 1 It works perfectly fine locally, I have no idea why wasp does not generate the missing files on build? I am using latest wasp cli as well. Any hints?
Prisma
Prisma | Simplify working and interacting with databases
Build, fortify, and grow your application easily with an intuitive data model, type-safety, automated migrations, connection pooling, caching, and real-time database subscriptions.
Prisma CLI reference | Prisma Documentation
This page gives an overview of all available Prisma CLI commands, explains their options and shows numerous usage examples.
6 Replies
Hi @BladyTancerz. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I can see you're having an issue with deploying your Wasp app to Railway, specifically with a missing file during the build process. This is a known issue that others have encountered when deploying Wasp applications.
The error indicates that the build process can't find the SDK file at
/app/.wasp/out/sdk/wasp/dist/server/index.js
which is needed for bundling your server code. This is likely happening because the Wasp SDK isn't being properly generated or copied during the deployment build process.
Based on the knowledge sources, there are a few potential solutions:
1. Clean and rebuild locally first:
Try running wasp clean
followed by wasp start
locally before deploying. This ensures all necessary files are generated properly as suggested in a similar issue.
2. Check your environment variables:
Make sure your database connection string is properly set up in your environment variables for Railway. Some users have reported fixing similar deployment issues by ensuring their environment variables are correctly configured as mentioned in this support thread.
3. Check for file path issues in your imports:
Ensure that all your imports in server files have the correct extensions (e.g., .js). Missing extensions can cause similar errors as noted in this GitHub issue.
4. Check for custom modifications:
If you've made any custom modifications to the Dockerfile or deployment process, make sure they're correctly set up. Some users have encountered issues when trying to copy custom code during deployment as seen in this support thread.
If none of these solutions work, you might want to try manually deploying your app following the instructions in the manual deployment documentation, which might give you more control over the build process.
Let me know if any of these suggestions help or if you need further assistance!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @BladyTancerz, 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?After full rebuild as suggested with
wasp clean
I got now error on some other file:
[server-builder 11/11] RUN cd .wasp/build/server && npm run bundle
[email protected] bundle rollup --config --silent[!] Error: Could not load /app/.wasp/out/sdk/wasp/dist/server/jobs/core/pgBoss/index.js (imported by src/server.ts): ENOENT: no such file or directory, open '/app/.wasp/out/sdk/wasp/dist/server/jobs/core/pgBoss/index.js' Error: Could not load /app/.wasp/out/sdk/wasp/dist/server/jobs/core/pgBoss/index.js (imported by src/server.ts): ENOENT: no such file or directory, open '/app/.wasp/out/sdk/wasp/dist/server/jobs/core/pgBoss/index.js' ✕ [server-builder 11/11] RUN cd .wasp/build/server && npm run bundle process "/bin/sh -c cd .wasp/build/server && npm run bundle" did not complete successfully: exit code: 1 Dockerfile:42 ------------------- 40 | RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma' 41 | # Building the server should come after Prisma generation. 42 | >>> RUN cd .wasp/build/server && npm run bundle 43 | 44 | ------------------- ERROR: failed to solve: process "/bin/sh -c cd .wasp/build/server && npm run bundle" did not complete successfully: exit code: 1 I've just confirmed that I can also successfully build the docker image locally, but it fails on Railway @kapa.ai any tips?
Let me check the knowledge base for you again. One moment! :books:
Wohooo @BladyTancerz, you just became a Waspeteer level 1!
----------------------
Based on your previous issue with deploying to Railway and the ENOENT error for the SDK files, here are some additional tips that might help:
1. Check your Wasp version: Make sure you're running at least Wasp 0.12.4, as there was a bug fix related to import issues in that version. You can check with
wasp version
and upgrade if needed with:
as mentioned in this support thread.
2. Try using a custom Dockerfile: You can create a custom Dockerfile in your project root that Wasp will use instead of the default one. This gives you more control over the build process and allows you to add custom commands if needed as explained in the deployment docs.
3. Memory issues: Some users have experienced deployment failures due to insufficient memory. If you're using a small instance (like an EC2 micro), this could be causing the build to fail as noted in this thread.
4. Manual build and deploy: Instead of using the Wasp CLI for deployment, try:
- Run wasp build
locally
- Navigate to .wasp/build
directory
- Deploy manually using Railway CLI with railway up
as described in the manual deployment docs.
5. Check file paths in your custom code: If you're copying custom files during deployment, make sure the paths are correct. Some users have had issues with incorrect paths when customizing their deployment as mentioned in this support thread.
Let me know if any of these suggestions help with your deployment issue!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @BladyTancerz, 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?I'd maybe say - try removing the apps from Railway and try again? Maybe something got cached?