-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
PubSubRelated to PubSub categoryRelated to PubSub categoryfeature-requestRequest a new featureRequest a new feature
Description
Describe the bug
If the MqttOverWSProvider is used for implementing the PubSub interface, and a non-JSON message is published to a topic that it is subscribed to, the following warning is printed:
[WARN] 27:28.905 MqttOverWSProvider - Error handling message, Array [
[SyntaxError: JSON Parse error: Unexpected identifier "non-json-input"],
"non-json-input",
]
To Reproduce
Steps to reproduce the behavior:
import Amplify from '@aws-amplify/core'
import PubSub from '@aws-amplify/pubsub';
import { AWSIoTProvider } from '@aws-amplify/pubsub/lib/Providers';
Amplify.configure(config);
Amplify.addPluggable(new AWSIoTProvider({
aws_pubsub_region: 'XXXX',
aws_pubsub_endpoint: 'wss://XXXX-ats.iot.us-east-1.amazonaws.com/mqtt',
}));
PubSub.subscribe("non-json-topic").subscribe({
next: msg => console.log("got", msg),
error: err => console.log("Failed to subscribe: ", err),
close: () => console.log("close"),
});
Note that you will need to publish a non-JSON message to the MQTT queue on the non-json-topic
.
Expected behavior
An option to disable JSON serialization/deserialization during publish and subscribe so these non-JSON messages can be properly handled.
visuddha, guszille, elkaadka, tom-gangemi and gabberr
Metadata
Metadata
Assignees
Labels
PubSubRelated to PubSub categoryRelated to PubSub categoryfeature-requestRequest a new featureRequest a new feature