W
Waspβ€’2mo ago
khb

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
kapa.ai
kapa.aiβ€’2mo ago
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:
flyctl secrets set SOME_VAR_NAME=somevalue

flyctl secrets set SOME_VAR_NAME=somevalue

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?
khb
khbOPβ€’2mo ago
here is some back end server logs if that helps
NEROX
NEROXβ€’2mo ago
NEROX
NEROXβ€’2mo ago
Do you use mailgun? Have you deployed the variables correctly?
No description
miho
mihoβ€’2mo ago
@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.
khb
khbOPβ€’2mo ago
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.
khb
khbOPβ€’2mo ago
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?
khb
khbOPβ€’2mo ago
another thing i find weird, is that in the vs code i get these errors when launching i do not get these when i wasp start. is this relevant at all?
NEROX
NEROXβ€’2mo ago
Some things that I see (IDK if it's relevant to you these missings)
No description
NEROX
NEROXβ€’2mo ago
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)
No description
miho
mihoβ€’2mo ago
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:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
Let's try setting the PORT env var one:
wasp deploy fly cmd --context server secrets set PORT=3001
wasp deploy fly cmd --context server secrets set PORT=3001
khb
khbOPβ€’2mo ago
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
MEE6
MEE6β€’2mo ago
Wohooo @khb, you just became a Waspeteer level 3!
miho
mihoβ€’2mo ago
You can the "Solved" tag πŸ™‚
No description

Did you find this page helpful?