Okta redirection with Lambda@Edge

Hello, I’ve implemented Lambda@Edge to authenticate users to my CloudFront distribution using Okta, I’m serving a PWA through this infrastructure. It works fine for some time, but if I leave the app on my screen for some time (the times seems to be random maybe a whole day, couple hours or some minutes) it will stop responding and show an error that says the page is unreachable or its contents have been move to another site, and on the console I receive the following error:

Access to fetch at “https://xxxx.oktapreview.com/oauth2/v1/authorize?client_id=xxxx...index.html” (redirected from “https://mysite.com/index.html__WB_REVISION__=xxxx”) from origin “https://mysite.com” has been blocked by CORS policy: No “Access-Control-Allow-Origin” header is present on the requested source.

What could be causing the issue? CORS is enabled on the Okta side since I’m able to access my site and work correctly on it. The error disappears if I do a hard refresh, clear the service worker storage or if I close the current tab and open in a new one.

Hi @luisalguien! Please open a support ticket through an email to support@okta.com with this issue, along with any network logs with failed requests made to Okta from your end. One of our Support Engineers can then proceed with a root cause analysis.