23 Replies
1οΈβ£ If you are trying to communicate from a client hosted on a different client URL than the one configured with
WASP_WEB_CLIENT_URL
, here's the situation:
There is a security feature in browsers called CORS (Cross-origin resource sharing) which controls from which URLs can you access certain servers.
In the future (very soon) we plan to offer CORS customisation, so you can send requests to the backend from clients living on a different URL that the WASP_WEB_CLIENT_URL
-> so, not possible at the moment
2οΈβ£ If you are trying to send requests from a mobile app for example, then you can, since the requests are not sent from a browser, so no CORS issues.
But we are not offering first-party support for that use of Wasp just yet! You would need to figure out the API endpoints by inspecting the requests in the console. That might change in the future as well π
-> possible, but you would need to figure out the APIthanks
what type of app are you looking to build @jv? maybe we can help more with various options if you can provide a bit more detail on the use case. thanks!
i was just thinking of letting other client url access the server api, I am having an app that is synchronous, and its waiting for a callback, that is from another service that is running.
ah ok cool, as @miho mentioned if it is another backend service (non-browser) then you should just be able to call it directly since it should not check/care about CORS related stuff.
we currently have a notion of Operations (Actions and Queries). those are mainly Wasp-related and we do some extra nice stuff there for users like handling data transfer between client and server, etc. they don't have "pretty URLs" or anything and aren't the main mechanism to use for exposing a public API really. coming this week we are launching an
api
keyword that will allow you to specify a verb and path pair (like GET /foo/bar
) and associate to a JS/TS function (similar look and feel to Operations). this may help your use case too, so keep your eyes peeled and let us know if you have any questions as you start your implementation. πthanks shayne
I'm seeing this CORS error as well because the backend and frontend are living on separate URLs. Any way around it?
This is happening while trying to login.
If you check the docs for deploying to Railway, we mention that you need to set the
WASP_WEB_CLIENT_URL
env variable to your client URL
https://wasp-lang.dev/docs/advanced/deployment/manually#deploying-the-serverDeploying Manually | Wasp
We'll cover how to deploy your Wasp app manually to a variety of providers:
Already added.
Still getting this.
Hm, super weird, I'm getting the same issue with your app. Did you try setting the env variable with the
/
at the end? It shouldn't make a different, but let's see if it doesI'll try
This is an app I have deployed, basically the same setup as you have
/ is already there
Sorry, I meant to say without π
Same result
The stripe payment won't work. And I'm afraid my project will get disqualified because of this.
Everything works fine If I run the project locally.
We want to figure this out π can you share your repo with me in the DMs so I can try to debug it? π
Sure.
@miho you managed to fix this in the latest release, right?
Yes sir, @Manan is aware of the change as well π
Yes. I confirm this has been resolved and I was really happy with the quick response. π₯³
Awesome!