question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Websocket connection error code 7 undefined

See original GitHub issue

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
    }
  }
`);

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nicklaroscommented, Nov 14, 2018

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

1reaction
appwizcommented, Sep 18, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket connection to 'ws://localhost:9090/' failed: Error in ...
I tried to run websocket with the url var wsUri = "ws://localhost:55195/" and it says WebSocket connection to 'ws://localhost:55195/' failed: Have been looking ......
Read more >
Connect failed: AMQJS0007E Socket error:undefined - HiveMQ
I got the error message: Connect failed: AMQJS0007E Socket error:undefined. I have the MQTTX client works with the mosquitto broker/server.
Read more >
WebSocket: error event - Web APIs | MDN
The error event is fired when a connection with a WebSocket has been closed due to an error (some data couldn't be sent...
Read more >
408078 – Client throws exception on connect error - Bugs
ERROR : WebSocket connection to 'ws://127.0.0.1/mqtt' failed: Unexpected ... Status code 404, Not Found undefined 7:AMQJS0007E Socket error:undefined.
Read more >
Using MQTT Over WebSockets with Mosquitto
MQTT over websockets allows you to send data to an MQTT broker from a ... On connect I receive error 7, “AMQJS0007E Socket...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found