Need Help with Production Deployment on VM (AWS/GCP)

Hey @kapa.ai ! Has anyone here done a production deployment directly on a VM (AWS/GCP) — where you build the Docker image inside the VM and deploy it there? I’ve been trying to do this for the past two days, but keep running into frustrating issues: - The bundle folder isn’t being generated - Files like package.json, node_modules, etc., are reported as missing — even though they do exist in the directory I’ve spent quite a bit of time troubleshooting but haven’t been able to resolve it yet. Any guidance, suggestions, or pointers would be hugely appreciated 🙏 WASP version - 0.16.4 Platform - Linux (VM)
6 Replies
kapa.ai
kapa.ai4w ago
Hi @Nilesh Kanawade. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Deploying a Wasp app to a VM on AWS or GCP by building the Docker image inside the VM is possible, but there are a few common pitfalls and steps to ensure things work smoothly. Key Steps for Production Deployment on a VM 1. Build the Wasp App - Run wasp build on your VM. This generates deployable code in the .wasp/build/ directory. Make sure you are using PostgreSQL as your database, as SQLite is not supported for production builds Deploying a Wasp App. 2. Check the Build Output - After running wasp build, you should see: - .wasp/build/server (Node backend) - .wasp/build/web-app/build (React frontend static files) - If these folders are missing, the build may have failed. Check for errors in the output of wasp build. 3. Docker Image Build - There is a Dockerfile in .wasp/build/ for the server. Use this to build your Docker image:
cd .wasp/build
docker build -t my-wasp-app .

cd .wasp/build
docker build -t my-wasp-app .

- If files like package.json or node_modules are reported as missing, double-check that you are running the Docker build from the correct directory and that the .wasp/build/server directory contains the expected files. 4. Common Issues & Troubleshooting - Missing Folders/Files: If the bundle folder or other files are missing, it could be due to a failed or incomplete build. Ensure your VM has enough resources (RAM/CPU), as low-resource VMs (e.g., 512MB RAM) can cause builds to hang or fail Discord: OpenSaas setup 'Role postgres does not exist'. - Manual NPM Installs: Sometimes, running npm install manually in .wasp/build/server or .wasp/build/web-app can help surface more detailed errors. - Permissions: Ensure your user has the necessary permissions to read/write in the build directories. 5. Deploying the App - Once the Docker image is built, you can run it as you would any Node.js app in Docker. Make sure to set the required environment variables for your app and database connection. 6. Frontend Deployment - The frontend is just static files in .wasp/build/web-app/build. You can serve these with any static file server (Nginx, Caddy, etc.) or even from within a Docker container. Additional Notes - Wasp does not have official, detailed documentation for AWS/GCP VM deployments, but the manual deployment guide applies Discord: Deploying to AWS. - If you continue to have issues, try building the app locally and copying the .wasp/build directory to your VM as a workaround. If you can share specific error messages or logs, the community may be able to provide more targeted help! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Nilesh Kanawade, 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?
Nilesh Kanawade
Nilesh KanawadeOP4w ago
@kapa.ai docker build -t myapp . gives below error: 25.16 npm ERR! code 1 25.16 npm ERR! path /app/.wasp/build/server/node_modules/esbuild 25.17 npm ERR! command failed 25.17 npm ERR! command sh -c node install.js 25.17 npm ERR! /app/.wasp/build/server/node_modules/esbuild/install.js:136 25.17 npm ERR! throw new Error(Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}); 25.17 npm ERR! ^ 25.17 npm ERR! 25.17 npm ERR! Error: Expected "0.25.8" but got "0.18.20" 25.17 npm ERR! at validateBinaryVersion (/app/.wasp/build/server/node_modules/esbuild/install.js:136:11) 25.17 npm ERR! at /app/.wasp/build/server/node_modules/esbuild/install.js:287:5 25.17 npm ERR! 25.17 npm ERR! Node.js v20.0.0 25.17 25.17 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2025-07-31T07_06_41_802Z-debug-0.log ------ Dockerfile:38 -------------------- 36 | COPY sdk .wasp/out/sdk 37 | # Install npm packages, resulting in node_modules/. 38 | >>> RUN npm install && cd .wasp/build/server && npm install 39 | COPY db/schema.prisma .wasp/build/db/ 40 | RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma' -------------------- ERROR: failed to build: failed to solve: process "/bin/sh -c npm install && cd .wasp/build/server && npm install" did not complete successfully: exit code: 1
Filip
Filip4w ago
Hey @Nilesh Kanawade, sad to see you struggle Let's see if we can figure it out Can you build and run the docker container locally, where you develop with Wasp? Let's try that before bringing GCP into the picture Also, are you maybe using a custom dockerfile? @miho Tagging you here as well if the thread gets busy while I'm gone
Vinay
Vinay3w ago
Hey @kapa.ai where can I find dockerfile for frontend
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Wasp does not generate a Dockerfile for the frontend by default. However, the official documentation and community examples show how you can create your own Dockerfile for the frontend if you need to deploy it as a static site in a container. A common approach is to manually create a Dockerfile in the .wasp/build/web-app directory after building the frontend. Here’s an example Dockerfile you can use, as shown in the docs:
FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html" ]
COPY ./build /srv/http
FROM pierrezemb/gostatic
CMD [ "-fallback", "index.html" ]
COPY ./build /srv/http
You should create this Dockerfile in .wasp/build/web-app after running the frontend build step. This is necessary because the .wasp/build/web-app directory is regenerated every time you run wasp build, so you’ll need to recreate the Dockerfile each time Deploying the Client (Railway). If you want to automate this, you can use a shell script as suggested in the docs to generate the Dockerfile and deploy the frontend Deploying the Client (Railway). In summary:
There is no auto-generated Dockerfile for the frontend; you need to create it yourself in .wasp/build/web-app after building the frontend. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Vinay, 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
You can run wasp dockerfile and it will print the contents of the Dockerfile

Did you find this page helpful?