W
Wasp4mo ago
yakito

Help Needed with OpenSaaS in GitHub Codespaces

Hey everyone! I’m running into a frustrating issue while trying to run OpenSaaS, deployed in GitHub Codespaces. Hoping to find someone who has navigated similar challenges or could point me in the right direction. Problem: • When I run wasp start, my app launches without issues, and the frontend works as expected. However, I’m consistently hitting a network-related error when trying to make API requests via Axios. Like when I visit /login and try to login for example • The error displayed in the console is an AxiosError with the message "Network Error" and code: "ERR_NETWORK". It seems to occur only when interacting with the API, not with the rest of the app. AxiosError {message: "Network Error", name: "AxiosError", code: "ERR_NETWORK", config: {…}, request: XMLHttpRequest} - baseURL: "http://localhost:3001" - url: "/auth/me" - method: "get" Setup: • Frontend and Backend: Hosted in GitHub Codespaces. • The backend is configured to listen on localhost:3001. Suspicions: • I suspect the issue may be related to how GitHub Codespaces handles port forwarding and tunnels localhost. It’s peculiar because the application itself runs fine; it’s just the API calls that fail. Has anyone faced similar issues with Axios or GitHub Codespaces? Any advice on configurations or workarounds to ensure API connectivity in this setup would be hugely appreciated! Thanks a ton! 🙏
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @yakito. 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, it seems like the issue might be related to the configuration of the server URL in your client app. The error message indicates that the client is trying to reach localhost:3001, which might not be accessible in the GitHub Codespaces environment. Here are a few steps you can try: 1. Check your environment variables: Ensure that the WASP_WEB_CLIENT_URL environment variable in .env.server matches your client URL. Similarly, set the REACT_APP_API_URL to your server URL on GitHub Codespaces. This was suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1217758453326680095). 2. Check your port settings: Make sure that the port 3001 is open on GitHub Codespaces. If something else is running on port 3001, it could cause issues. This was also mentioned in the same Discord support thread (https://discord.com/channels/686873244791210014/1217758453326680095). 3. Check the server URL in the client app: You might need to adjust the server URL in your client app to point to the correct IP and port. Here's the Wasp documentation (https://wasp-lang.dev/docs/advanced/deployment/manually#3-deploying-the-web-client-frontend) on how to set the server URL on the client app. If you're still facing issues, it might be helpful to look into how GitHub Codespaces handles port forwarding and tunnels localhost, as you suspected. Unfortunately, I don't have specific information on that from the provided sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @yakito, 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?
yakito
yakitoOP4mo ago
I hate when this happens, the moment you post a question asking for help, you find the solution 😆 In my case I found out that if I set the port visibility for the server URL (3001) then it works. Hope this helps someone else! I was trying to make this work inside replit but that is prooving a bit more challenging because replit is not generating a unique URL for the server portion.
Filip
Filip4mo ago
Haha, glad you found it @yakito! Yeah, those pesky ports are always a problem when building in a virtual network. Glad you figured it out!
Want results from more Discord servers?
Add your server