aws-mobile-appsync-sdk-js icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-js copied to clipboard

Appsync sdk doesn't report error on subscription

Open zhaoyi0113 opened this issue 5 years ago • 1 comments

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? Bug

What is the current behavior? The appsync client doesn't throw error if there is an error happened on subscription.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. I have below code to

const onTransactionUpdate = (gq: AWSAppSyncClient<any>) => {
  gq.subscribe({
    query: gql`
      subscription {
        onTransactionUpdate(id: "dd") {
          id
        }
      }
    `,
  }).subscribe({
    next: (data: any) => {
      console.log('get subscribed data:', data);
    },
    error: (err) => console.error('get error:', err),
  });
};

const client = new AWSAppSyncClient({
    url,
    region: 'ap-southeast-2',
    auth,
    disableOffline: true
  });
onTransactionUpdate(client)

The code doesn't report any error even if I pass an invalid auth credential.

What is the expected behavior? I expect it throws an error if there is anything wrong happens during subscription.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions? 3.0.3

zhaoyi0113 avatar Jul 10 '20 04:07 zhaoyi0113

Any update on this?

cmutzel avatar Dec 13 '21 17:12 cmutzel