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 to 'ws://127.0.0.1:9944/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED Provider.js:380

See original GitHub issue

In the substrate-front-end-template folder, I cmd’d yarn add @polkadot/api


CHROME

The node runs in one tab of my browser, but a new tab with the same URL comes up which gives me the error:

Error Connecting to Substrate
Error: FATAL: Unable to initialize the API: createType(StorageKey):: Derived TypedArray constructor created an array which was too small

In the console:

WebSocket connection to 'ws://127.0.0.1:9944/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Provider.js:380

FIREFOX

I got only one tab, with a different error written:

Error Connecting to Substrate

Error: FATAL: Unable to initialize the API: createType(StorageKey):: expected TypedArray of at least length 4, but constructor returned TypedArray of length 0

Console:

API/INIT: Error: FATAL: Unable to initialize the API: createType(StorageKey):: expected TypedArray of at least length 4, but constructor returned TypedArray of length 0
Init.js:85

I read your closed thread about this error, and I assume it’s not an easy one to trace, so hopefully my excessive information can help you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jacogrcommented, Oct 15, 2020

Yes, you can manually fix it - I would always recommend the latest stable version in the case 2.2.1 - https://github.com/polkadot-js/api/releases

Just ensure you change both the @polkadot/api & @polkadot/types lines (they always go hand-in-hand). After that, do a yarn and it should be ok.

0reactions
polkadot-js-botcommented, Jun 3, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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