Site works in dev but in production is not working
Hello again friends! We've finally launched to production! π
https://siteengineer.com.au/
The site works when I run it in development mode, however, after launching, the login option disappears and the website doesn't seem to work (though it still builds). I've included the command line output which shows several errors I'm unsure about, along with the errors that VS Code outputs when I launch the site. Would anyone have any suggestions? my version is 15.1 (updated from 14.x), my platform is windows / wsl2. all errors are attached :))
My Open SaaS App
I made a SaaS App. Buy my stuff.
14 Replies
Hi @khb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, it seems your issue is related to deployment and environment configuration. Let's go through some potential causes and solutions:
1. Environment Variables:
Make sure you've properly set up all the necessary environment variables for production. As mentioned in the Wasp docs on env variables (https://wasp-lang.dev/docs/project/env-vars#defining-env-vars-in-production), you need to provide server env vars differently in production compared to development. For example, if you're using Fly.io, you would set secrets using the
flyctl
CLI tool:
Ensure all required variables, especially those related to authentication (like Google client ID), are properly set in your production environment.
2. Database Migration:
It's possible that your database schema needs to be updated in production. As discussed in a GitHub issue about database migration (https://github.com/wasp-lang/wasp/issues/215), you might need to run database migrations as part of your deployment process. Consider running wasp db migrate-prod
(or equivalent command) before deploying your app.
3. Build Process:
The Wasp docs on accessing app config (https://wasp-lang.dev/docs/advanced/accessing-app-config) mention that the client process in production serves pre-built static files with environment variables embedded during the build. Make sure your build process is correctly incorporating all necessary environment variables.
4. Server Configuration:
Double-check your server configuration, especially the frontendUrl
setting. As mentioned in the Wasp docs, you should set this to your client's URL as the server sees it in production.
5. Proxy Issues:
There's a known issue with Wasp's dev server (https://github.com/wasp-lang/wasp/issues/1255) that can cause Failed to fetch
errors. While this primarily affects development, it's worth checking if similar issues could be occurring in your production setup.
6. Deployment Process:
Review your deployment process to ensure all steps are being executed correctly. The Wasp docs on deployment (https://wasp-lang.dev/docs/advanced/deployment/manually#environment-variables) provide guidance on setting up environment variables and other deployment considerations.
To troubleshoot further:
1. Check the server logs in your production environment for any error messages.
2. Use browser developer tools to inspect network requests and console errors on the client side.
3. Verify that all necessary environment variables are correctly set in your production environment.
4. Consider temporarily enabling more verbose logging in your production environment to gather more information about the issues.
If the problem persists after checking these areas, you may need to provide more specific error messages or logs for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @khb, 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?here is some back end server logs if that helps
hmm server is down https://site-engineer-server.fly.dev/
Do you use mailgun? Have you deployed the variables correctly?
@khb as @NEROX pointed out, your server is down (that's why the login button disappears) - do you see any errors in the server logs?
Did you set all the env variables on Fly - remember, what you have in
.env.server
is not copied over to the production env, you need to define all the env variables you need e.g. Mailgun API key, Google ID and secret etc.Ohhh okay, ill have to try do that tonight. My bad ill keep this post updated if that fixes my problem. Thanks for the help guys.
I also do use mailgun, however i dont think i have deployed the varables correctly.
I tried adding the variables (by relaunching), but it didn't work. Here are the outputs from the command line and server logs from fly.io - can you check if I set them up correctly?
Some things that I see (IDK if it's relevant to you these missings)
As I see that (almost certainly), the same thing is happening to you as to me:
https://discord.com/channels/686873244791210014/1304016184621928520
Maybe you can use it as a solution (just last 1-2 messages)
This errors should go away after you
wasp start
again and restart VS Code, let me know if they stay after the restart?
Hm, I'm not sure what's going on but ... I saw this error message:
Let's try setting the PORT
env var one:
Thanks so much for the help ππͺπͺ ill report back on tomorrow on those two solutions ππ
you guys are amazing, works now π
how do i tag this as solved for future people
Wohooo @khb, you just became a Waspeteer level 3!
You can the "Solved" tag π