Mixpanel Community Icon

CORS Issues with Mixpanel Session Recording: Need Help!

·
·

I'm trying to use session replay and I'm running into a CORS issue; particularly, when I run mixpanel.start_session_recording() I get the following error in the dev console

Access to fetch at 'https://api-js.mixpanel.com/record/?%24current_url=https%3A%2F%2Flocalhost%3A3005%2Fprojects%2FgFS92QMj-zIEb0W9GRZjGQ&%24lib_version=2.62.0&batch_start_time=1742999984.965&distinct_id=96f46c0b-19a2-4a63-b654-ab74292ee88e&mp_lib=web&replay_id=cdc8f2b9-8008-4f38-96c5-bfd95f83c959&replay_length_ms=9835&replay_start_time=1742999984.965&replay_start_url=https%3A%2F%2Flocalhost%3A3005%2Fprojects%2FgFS92QMj-zIEb0W9GRZjGQ&seq=0&%24device_id=96f46c0b-19a2-4a63-b654-ab74292ee88e&%24user_id=sdfsdf%40sdcadsc.xom&format=gzip' from origin 'https://localhost:3005' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Has anyone else run into this kind of stuff? Normally I'd be able to fix it by appending the correct headers, but the post request is made from inside the mixpanel library, and I don't have access to that...

  • Avatar of Vlad S.
    Vlad S.
    ·
    ·

    answering my own question: this turned out not to be a CORS issue, I was accidentally passing an empty project token to the initializer, but for some reason that resulted in a CORS issue in the browser...