W
Wasp-lang•6mo ago
PastaGringo

WASP_SERVER_URL not applied into ToDoApp tutorial

Hi, I'm doing the Wasp tutorial TodoApp from one of my VPS. The frontend run on a https URL and the backend needs to run on another https URL. I've configued on nginx proxy "wasp.domain.tld" to redirect frontend url to localhost:3000 and another proxy "wasp.domain.tld" to localhost:3001. I've updated the .env file with: WASP_SERVER_URL=https://wasp-backend.domain.tld WASP_WEB_CLIENT_URL=https://wasp.domain.tld When I start the project with wsap start and access to the frontend I can see "Loading..." & "AxiosError: Network Error". When I check the console I can find that the backend is searched with url http://localhost:3001/operations/get-tasks This URL should have been updated with the WASP_SERVER_URL env var no? Thanks 🙂
18 Replies
kapa.ai
kapa.ai•6mo ago
Hi @PastaGringo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It seems like you're having trouble with the environment variables WASP_SERVER_URL and WASP_WEB_CLIENT_URL. However, based on the provided knowledge sources, Wasp uses REACT_APP_API_URL and WASP_WEB_CLIENT_URL as environment variables to control the backend server's URL and the URL of where the frontend is running respectively. You might want to set REACT_APP_API_URL to your backend server's URL and WASP_WEB_CLIENT_URL to your frontend's URL in the .env file. Here's an example of how you might set these variables:
REACT_APP_API_URL=<https://wasp-backend.domain.tld>
WASP_WEB_CLIENT_URL=<https://wasp.domain.tld>
REACT_APP_API_URL=<https://wasp-backend.domain.tld>
WASP_WEB_CLIENT_URL=<https://wasp.domain.tld>
Please note that these URLs should be valid and absolute. If they are not, you might encounter errors. For instance, if the URL has a trailing slash, it might lead to CORS errors. If you're still encountering issues after making these changes, it might be helpful to check the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#3-deploying-the-web-client-frontend) or the Wasp community on Discord (https://discord.com/channels/686873244791210014/1222010179537866902) for further assistance. Sources: - Github Issue (closed): Ensure the REACT_APP_API_URL and WASP_WEB_CLIENT_URL env vars are valid URLs (https://github.com/wasp-lang/wasp/issues/756) - Discord support thread: AxiosError > Answers Part 3 (https://discord.com/channels/686873244791210014/1222010179537866902) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @PastaGringo, 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?
PastaGringo
PastaGringoOP•6mo ago
does the correct path for the .env file to modify is : TodoApp/.wasp/out/server/.env @kapa.ai @kapa.ai
kapa.ai
kapa.ai•6mo ago
Let me check the knowledge base for you. One moment! :books: Sorry @PastaGringo, 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?
PastaGringo
PastaGringoOP•6mo ago
Resolved after a cache refresh ... 😄
martinsos
martinsos•6mo ago
Nope, that is internal .env, you should be editing TodoApp/.env.server or TodoApp/.env.client ! @PastaGringo how did this go at the end, did you manage to host Wasp this way? Can you help me understand this a bit better, we had multiple peple be asking about running Wasp behind the VPS but I don't have much experience with it. What is you rmotivation for doing so, why run it on VPS? Also, what does it mean to run it on VPS -> run it like that during development, with wasp start, or actually deploy to it for production (so doing wasp build and then deploying that stuff to VPS)?
PastaGringo
PastaGringoOP•6mo ago
Hi @martinsos 🙂 It working now I found the correct .env file thanks! Personnaly I run web project on my vps not on my local desktop or VM. I don't want to "pollute" with all the dev stuff I'm doing and having to reinstall everything because I messed up somewhere. So I basicaly pay 3$/month to have an vps and dev on it. The only particularity is I have to handle the network interface part because it should listen from 0.0.0.0 instead of 127.0.0.1. I also use docker and nginx proxy manager to have valid SSL cert. I also working from different computer (PC/Mac/Linux) so it's easier to have a dedicated vps where all my projects are located rather than having projects on multiple desktops.
MEE6
MEE6•6mo ago
Wohooo @PastaGringo, you just became a Waspeteer level 1!
martinsos
martinsos•6mo ago
Ok got it! So basically you are paying for a remote dev machine. Nice to hear you got it working! So besides network interface and docker and nginx, anything Wasp specific that you found needed configuration, I guess not? We had some other people wanting to do it from VPS, I guess the answer would be it will probably be mostly speciifc to their VPS setup, not so much Wasp?
Killshot
Killshot•6mo ago
So did you successfully start wasp on a VPS? I am thinking of doing same shortly.
PastaGringo
PastaGringoOP•6mo ago
Yes it finally worked 🎉
Killshot
Killshot•6mo ago
wow impressive. I am gonna do it shortly, but working on integrating another payment provider rather then Stripe.
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
which payment provider will you integrate?
Killshot
Killshot•6mo ago
Lemon Squeezy I am from india and Stripe stopped onboarding new customers from here. so for me it's an inconvinient regulatory issue.
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
awesome. Maybe we spoke about this already, but if you could consider submitting a PR to the Open SaaS template, that would be huge! We can help you any step of the way
Killshot
Killshot•6mo ago
I would be more then happpy to do it, Will let you know when i am finished testing.
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
perfect. I'll try my best to help you with any questions you may have during implementation and the PR process in #🚀open-saas -- we can start a thread there maybe actually, maybe it's best to jsut start a new thread here in #🙋questions in case anyone else gets stuck with the same problems
Killshot
Killshot•6mo ago
You got it boss, will do it.
Vinny (@Wasp)
Vinny (@Wasp)•6mo ago
thanks!
Want results from more Discord servers?
Add your server