40013: Invalid message data or encoding

invalid_data_or_encoding

A message was rejected because its data was of an unsupported type, or because the encoding declared for the data could not be applied or reversed.

What you should do

Publish data of a supported type. Message data must be a string, binary data (such as a Buffer, ArrayBuffer, or TypedArray), or a plain object or array that serializes to JSON. Convert other types, such as Date, Map, or Set, to one of these before publishing. If you set an encoding yourself, make sure it correctly describes the data.

Why it happens

The SDK couldn't serialize the message payload, or the declared encoding couldn't be applied or reversed. This usually means the data was of a type the SDKs don't support, so it can't be represented as JSON or MessagePack.

What you'll see

The error is reported with code 40013 and HTTP status 400. The message is typically Data type is unsupported, and it is often raised by the SDK before the message is sent.