awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

Appsync sdk doesn't report error on subscription #574

Open zhaoyi0113 opened 4 years ago

zhaoyi0113 commented 4 years ago

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

cmutzel commented 2 years ago

Any update on this?