aws-mobile-appsync-sdk-js: Websocket connection error code 7 undefined

Dear aws contributors,

{[DEBUG] 05:15.670 AuthClass - getting session failed: "No userPool"}
ConsoleLogger.js:84 [DEBUG] 05:15.672 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 05:15.673 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 05:15.691 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:100 {[DEBUG] 05:15.691 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 05:15.693 AWSPinpointProvider - cannot send events without credentials, applicationId or region
ConsoleLogger.js:84 [DEBUG] 05:15.695 AWSPinpointProvider - cannot send events without credentials, applicationId or region
paho-mqtt.js:1050 WebSocket connection to 'wss://a12t2jth1f5u55.iot.us-east-2.amazonaws.com/mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***us-east-2%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20180918T150516Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=0fe9185dda08b65f607bb5865f6298dbd2997d3a8c7bb32408849464c204b782&X-Amz-Security-Token=***' failed: Error in connection establishment: net::ERR_CERT_SYMANTEC_LEGACY
LibraryFactory.ClientImpl._doConnect @ paho-mqtt.js:1050
LibraryFactory.ClientImpl.connect @ paho-mqtt.js:886
Client.connect @ paho-mqtt.js:2025
(anonymous) @ subscription-handshake-link.js:117
SubscriptionHandshakeLink._this.connect @ subscription-handshake-link.js:116
SubscriptionHandshakeLink._this.connectAll @ subscription-handshake-link.js:105
localhost/:1 Uncaught (in promise) {invocationContext: undefined, errorCode: 7, errorMessage: "AMQJS0007E Socket error:undefined."}
paho-mqtt.js:1050 WebSocket connection to 'wss://a12t2jth1f5u55.iot.us-east-2.amazonaws.com/mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***us-east-2%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20180918T150516Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=fade74ad9480e7f09d5012e87cbc59208d05c8d554d72404a04024a58fd0bccc&X-Amz-Security-Token=***' failed: Error in connection establishment: net::ERR_CERT_SYMANTEC_LEGACY
LibraryFactory.ClientImpl._doConnect @ paho-mqtt.js:1050
LibraryFactory.ClientImpl.connect @ paho-mqtt.js:886
Client.connect @ paho-mqtt.js:2025
(anonymous) @ subscription-handshake-link.js:117
SubscriptionHandshakeLink._this.connect @ subscription-handshake-link.js:116
SubscriptionHandshakeLink._this.connectAll @ subscription-handshake-link.js:105
localhost/:1 Uncaught (in promise) {invocationContext: undefined, errorCode: 7, errorMessage: "AMQJS0007E Socket error:undefined."}
ConsoleLogger.js:84 [DEBUG] 05:21.345 Credentials - getting credentials
ConsoleLogger.js:84 [DEBUG] 05:21.346 Credentials - picking up credentials
ConsoleLogger.js:84 [DEBUG] 05:21.346 Credentials - getting new cred promise
ConsoleLogger.js:84 [DEBUG] 05:21.347 Credentials - checking if credentials exists and not expired
ConsoleLogger.js:84 [DEBUG] 05:21.347 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js:84 [DEBUG] 05:21.348 AuthClass - Getting current user credentials
ConsoleLogger.js:84 [DEBUG] 05:21.349 AuthClass - Getting current session
ConsoleLogger.js:100 {[DEBUG] 05:21.349 AuthClass - getting session failed: "No userPool"}
ConsoleLogger.js:84 [DEBUG] 05:21.350 Credentials - setting credentials for guest
ConsoleLogger.js:84 [DEBUG] 05:21.350 Credentials - No Cognito Federated Identity pool provided
ConsoleLogger.js:100 {[DEBUG] 05:21.350 AWSPinpointProvider - ensure credentials error: "No Cognito Federated Identity pool provided"}
ConsoleLogger.js:84 [DEBUG] 05:21.351 AWSPinpointProvider - cannot send events without credentials, applicationId or region

Anyone got this error too ?? Can’t figure out why, I have checked in other issues…

We are using the latest reactjs packages, still the subscription fails approx. 1 over 3 for every page refresh: A.

package.json:

  "dependencies": {
    "@babel/runtime": "^7.0.0",
    "apollo-client": "^2.4.2",
    "aws-amplify": "^1.1.1",
    "aws-amplify-react": "^2.0.2",
    "aws-appsync": "^1.3.4",
    "aws-appsync-react": "^1.1.4",
    "aws-sdk": "^2.316.0",
    "enzyme": "^3.6.0",
    "enzyme-adapter-react-16": "^1.5.0",
    "graphql": "^14.0.2",
    "graphql-tag": "^2.9.2",
    "node-sass-chokidar": "^1.3.3",
    "npm-run-all": "^4.1.3",
    "react": "^16.5.1",
    "react-apollo": "^2.1.11",
    "react-dom": "^16.5.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^1.1.5"
  },

Result.js:

import OnCreate from "./GraphQL/OnCreate";
import QueryWithIndex from "./GraphQL/QueryWithIndex";
import { Component } from "react";
import { compose, graphql } from "react-apollo";

class ResultsT extends Component {
  render() {
    return (null);
  }
}

const Results = compose(
  graphql(
    QueryWithIndex, {
      props: ({ data: { subscribeToMore } }) => subscribeToMore({ document: OnCreate }),
    })
)(ResultsT);

export default Results;

App.js

import AppSync from "./AppSync";
import awsmobile from './aws-exports';
import Results from './Results';
import Amplify from 'aws-amplify';
import AWSAppSyncClient from "aws-appsync";
import { Rehydrated } from "aws-appsync-react";
import React, { Component } from "react";
import { ApolloProvider } from "react-apollo";

Amplify.configure(awsmobile);

window.LOG_LEVEL='DEBUG';

const client = new AWSAppSyncClient({
  url    : AppSync.graphqlEndpoint,
  region : AppSync.region,
  auth: {
        type: AppSync.authenticationType,
        apiKey: AppSync.apiKey
    },
    disableOffline: true
});

class App extends Component {
  render() {
    return (
      <Results />
    );
  }
}

const WithProvider = () => (
    <ApolloProvider client={client}>
        <Rehydrated>
            <App />
        </Rehydrated>
    </ApolloProvider>
);

export default WithProvider;

Index.js

import App from './App';
import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render( <App />, document.getElementById('root') )
export default gql(`
  subscription {
    onCreate {
      __typename
      id
      awsIdentityId
    }
  }`
);
export default gql(`
  query($limit: Int, $nextToken: String) {
    queryWithIndex(limit: $limit, nextToken: $nextToken) {
      items {
        __typename
        id
        awsIdentityId
      }
      nextToken
    }
  }
`);

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

If you are running subscriptions in node, try this:

From #286 (comment)

This could be the version of the websocket lib you have installed in node as a specific polyfill is needed. If you look here: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-node.html You will see “ws”: “^3.3.1”. Could you try the instructions listed on that page?

confirmed using ws lib version ^4.0.0 and it works fine. but not with ^5.0.0, I guess it is related with some major version breaking changes

Thanks for the info. I’m looking into it to figure out what’s going on.