Hey folks, running into a weird CORS block trying to embed the Genesys Messenger widget in a Next.js app. We’re using the genesys-cloud-messenger-react package, but it’s failing hard on the server side.
Here’s the setup:
import { GenesysCloudMessenger } from '@genesyscloud/messenger-react';
export default function ChatWidget() {
return (
<GenesysCloudMessenger
orgId={process.env.NEXT_PUBLIC_GENESYS_ORG_ID}
deploymentId={process.env.NEXT_PUBLIC_DEPLOYMENT_ID}
/>
);
}
The error is Access to fetch at 'https://api.mypurecloud.com/api/v2/conversations/webmessaging' from origin 'http://localhost:3000' has been blocked by CORS policy.
I’ve checked the Genesys console and added http://localhost:3000 to the allowed origins for the web messaging deployment. The client-side hydration works fine, but the initial SSR render tries to fetch the config and chokes. It seems like the server is making the request without the right headers, or maybe the SDK isn’t handling the SSR context correctly.
Has anyone got a workaround for this? We’re stuck on Next.js 13 with App Router. Not sure if we need to proxy the request or if there’s a flag to disable the server-side fetch.