400 and CORS Errors on a Experiment Route

  • 15 September 2022
  • 1 reply

Hey !

Since 1 or 2 weeks I start to have a CORS / 400 Error on a specific route which is:

It happens only in dev / staging env (both same API KEYS) where it doesn’t happen in my production env.

I tried a lot of stuff: generating new API KEYS, removing all staging experiments, updating SDK versions, changing pc, network but nothing seems to change that, it seems to be related to the staging project/deployment on Amplitude Experiment.

It’s really annoying for my devs and me as it’s spamming constantly the console and as a dev, having errors in the console is just frustrating.

If you have any clue on that subject, please help me, thanks! :)


Best answer by Yuanyuan Zhang 22 September 2022, 17:16

View original

1 reply

Userlevel 4
Badge +5

Update from @Liroo:

Cause: On our staging / dev env we have a User property that is oversized. What I mean is that you seem to generate the `x-amp-exp-user` header based on User property we set in Amplitude Analytics and sending it to every experiment http request.

Without warning or error on your side you generate a large x-amp-exp-user header that you can't handle on your server as you answer a CORS Error where it's only a HTTP Header too large.

Workaround: reduce our user property 


Update from Amplitude: 

We will work on displaying a more clear warning or error.