Home
Support Forums

Getting a CORS error,but only on netlify dev deploys

I’m seeing

Error: A cross-origin error was thrown. React doesn’t have access to the actual error object in development. See https://fb.me/react-crossorigin-error for more information.

I don’t get this error after a netlify build/deploy. The link above notes that WebPack can decide to use eval expressions, which can trigger this error. I suspect that is the problem. This started to happen when using localStorage that had JSON serializer/reviver functions.

Found the issue, though the error does not make any sense.

function deserializer(json) {
    return JSON.parse(json);
}

...
deserialize("{}")                // okay
deserialize("undefined")   // CORS exception