-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORS issue #15
Comments
Suppose the HTTP vs HTTPS issue was out of the way, unless I'm mistaken I don't see a |
@marcperrinp it is possible. But you just need to set up a http proxy and direct it at the environment you want to interact with. |
@jankjr I tried in production, which runs on HTTPS of course, and I'm getting the same error.. Are you saying there is a way to bypass the fact that Nash API's response doesn't contain a |
I think our CORS headers are restrictive for security reasons. So the browser probably won't let you call our service directly. But what you can do is run an a small express server to act as a proxy for your browser app, which will remove the CORS restriction as you are calling your own service. It is essentially how our development setup works. Below is an example of now it can be configured for our production environment.
If your proxy is hosted at
Once you deploy the service somewhere, say
|
Thanks a lot @jankjr. Unfortunately I cannot set up a custom express app, as I'm using Vercel which only provides serverless functions. It works since I don't have the CORS issue anymore, but somehow it looks like I'm not getting a response. After some time, it appears I'm getting an "Invalid timestamp" error, but it may be due to some sort of timeout? Anyway I just tried now (in production) at around 7:23:50 UTC if you have logs and time to check it out. I'll continue to investigate, thanks again. |
@marcperrinp I think you can run a proxy in a serverless setup as well. But of course my snippet can't be used without some modifications then :) Have you updated to the very latest SDK? It is the only thing I can think of that is causing the issue. |
@jankjr Upgrading to 5.0.35 (from 5.0.31) solved it!... for a minute only 🙀 It was working on my staging (which is connected to Nash's Production), but when I released to Production shortly after it wasn't anymore. Now back on my staging , it's not working anymore. Those were the successful trades, so it was at around 11:30PM (UTC+2 time): Did anything change on Nash side? |
Not sure @marcperrinp Can you double check that the time is set correctly on your computer? I've seen that sometime the browser is reporting incorrect time. |
@jankjr Your answer helped me identify the issue. It is two-fold:
On the next spins, the chunks don't need to be fetched again so passing the order via the API goes smooth. To solve this, I guess I'll have to dig into Webpack to understand how to have it pre-download those chunks. Thanks for reading, I'm explaining in details hoping it could help others in the future 😄 |
Hi @jankjr, I'm writing to you again after having tried many things, but I couldn't get it to work. I narrowed it down to the fact that those 3 chunks are downloaded precisely when calling Do you have any idea what they could be? |
I know I suggested this before in a different context, I am wondering if you could retry the call if it fails?
I am not sure I know how to coerce Webpack into behaving. |
@jankjr Thanks for the reply! I tried it but it does not work. What's happening actually is that the
after 30+ seconds a response is returned (30s feels like it might have timed out, but weirdly I do get a response..): then only is the actual placeLimitOrder mutation called: and unsurprisingly, the return is an "Invalid timestamp" error: As a result the My questions are the following:
Thanks again for your time, Jan! |
This is partly solved thanks to one of @jankjr's PRs. Adding this snippet to your code will prevent the delay/timeout:
I'm keeping this thread open because I'm still having a freeze issue. It's due to the browser doing some calculations which throttles the RAM, apparently. I'll be this thread updated with any additional info. |
Trying to make an API request from the browser, but I'm getting a CORS error:
I guess I need to fix this on my side*, but could you just confirm this is the right way to include a header at client login:
* : Not sure if there's any way to make this work locally since I'm in HTTP. Probably will just need to add local certificates to be in HTTPS, but will it be enough?
Any tips would be appreciated :)
The text was updated successfully, but these errors were encountered: