W
Wasp-langβ€’6mo ago
mb23

Server is blocked by CORS policy

Hi there, I have the following problem: I have deployed my app to Railway (server, PostgreSQL and client). The app is "live" but if I want to sign up as a user it tells me: Network error and I get the following issue in the Browser console: signup:1 Access to XMLHttpRequest at 'https://server-production-...railway.app/auth/me' from origin 'https://client-production-....railway.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. index-Bpk1JXu_.js:57
GET https://server-production-....railway.app/auth/me net::ERR_FAILED 401 (Unauthorized) I have already added all env variables to server and client and am wondering what I can do about this issue?
No description
No description
8 Replies
kapa.ai
kapa.aiβ€’6mo ago
Hi @mb23. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, it seems like you might be facing a CORS (Cross-Origin Resource Sharing) issue. This typically happens when a web application tries to access resources from a different domain, protocol, or port than its own. In the context of Wasp and Railway, you might need to ensure that your server is correctly configured to allow requests from your client's domain. This usually involves setting certain headers in your server's responses, such as Access-Control-Allow-Origin. Unfortunately, the provided knowledge sources do not contain specific information on how to resolve CORS issues with Wasp and Railway. I would recommend checking the Wasp documentation or reaching out to the Wasp community for further assistance. Here are some useful links: - Wasp Documentation (https://wasp-lang.dev/docs) - Wasp Discord Community (https://discord.com/invite/rzdnErX) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @mb23, 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?
miho
mihoβ€’6mo ago
Deploying Manually | Wasp
This document explains how to build and prepare your Wasp app for deployment.
miho
mihoβ€’6mo ago
Is the URLin the WASP_WEB_CLIENT_URL set to https://client-production-....railway.app/ or something else?
mb23
mb23OPβ€’6mo ago
@miho Yes, I've followed the steps. Not sure if I've missed something or so. I tried deleting everything and doing it all over again and now it works πŸ™‚ Only sending emails doesn't work. Do i have to add my .env.server variables as variables in Railway to the server section? Works now πŸ™‚ Only sending emails doesn't work yet @miho Okay, now, I've connected a custom domain and the same issue as before occurs. I've changed the WASP_WEB_CLIENT_URL in the server section ot the custom domain already but still, it doesnt work
MEE6
MEE6β€’6mo ago
Wohooo @mb23, you just became a Waspeteer level 2!
miho
mihoβ€’6mo ago
Yep, any env vars you used locally, you need to add on Railway, otherwise your server doesn't know that info πŸ™‚
mb23
mb23OPβ€’6mo ago
thanks, make sense πŸ™‚
martinsos
martinsosβ€’6mo ago
Ah yes sorry about that, we do have an issue to improve the docs regarding that! https://github.com/wasp-lang/wasp/issues/2053
Want results from more Discord servers?
Add your server