Real Time Authentication Error

Hi!

I’m trying to implement Next.js preview mode with real time data subscription.

The subscription works (which requires a valid token to connect) and reaches the connected status. However the first event that comes through is a channelError:

{
  "response": {
    "data": [
      {
        "type": "api_error",
        "id": "5413bc",
        "attributes": { "details": {}, "code": "INVALID_AUTHORIZATION_HEADER" }
      }
    ]
  },
  "message": "The query returned an erroneous response. Please consult the response details to understand the cause.",
  "fatal": true,
  "code": "INVALID_QUERY"
}	

What could be causing this?

Thanks

Hello @lluis

Can you send us the snippet of code that is causing this (client creation + subscription creation + query being made) to us at support@datocms.com so we can take a closer look at it?

Thank you!

Just sent it. Thanks!

As usual, it was my fault. Wrong token being used :frowning: