Intermittent CORS issue

Expected behavior

All requests should hit our backend and be successful.

Actual behavior

We’re experimenting intermittent request failures (I’d say 5%) for all requests made from Forest to our backend (either GET or PUT requests, displaying a data table, a summary, a related data table or submitting a smart action). 95% of our requests are just working fine.

The network tab says it is a CORS failure. I have been unable to reproduce locally.

Error message (I clicked ‘Update’ and ‘Save’ on a record 2 times. Same request, same API, no change between the 2 requests).
Capture d’écran 2021-07-16 à 18.32.28

Some failure logs:

Failure Logs

Please include any relevant log snippets, if necessary.

Context

  • Package Version: gem ‘forest_liana’, ‘6.6.2’
  • Database Dialect: postgres
  • Database Version: 11
  • Project Name: okarito

Hello @remi_okarito

If I understand your report correctly

Your browser is reporting CORS errors

  • Which happen on all routes on the agent
  • Which happen in production only, never in development
  • Which happen randomly on 5% of queries

Just in case, did you read this page in the documentation? I don’t think it can help, as all queries would fail if the agent was not configured correctly.

Maybe (this is a bit far-fetched):

  1. your agent crashes
  2. the reverse proxy replies with a “502 Bad Gateway Error” which does not have the CORS headers (because the agent is not reachable)
  3. you get a CORS error in the browser

Without more information, it’s difficult to debug this: I see no obvious reasons, nor know of other customers with the same issue.

To help you, could you provide

  • logs (from reverse proxy / agent)
  • more detail about a failed request/response
  • information about when does that happen
    • Did you upgrade to a new version of the agent recently?
    • When did the problem start appearing?
    • What changed at this moment?
1 Like

Hello @anon39940173, you’re right, this definitely looks like a load balancer issue on our side and does not seem related to forestadmin.

I’ll investigate further on this, thank you for your time and attention.

Remi