1

I've been following through the pallets tutorial: https://docs.substrate.io/tutorials/work-with-pallets/use-macros-in-a-custom-pallet/ and got stuck at the last step of interacting with the blockchain.

The error I'm getting: "Cannot convert undefined or null to object" happens when I try to access https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/. The code of substrate-node-template compiles with no errors and the repo is fresh.

  • OS: MacOS 12.3.1
  • Browser: Brave (Version 1.46.153 Chromium: 108.0.5359.128 - x86_64)

Note. I also looked into Connecting to a chain on `ws` localhost with polkadot.js app fails when running in brave browser but my problem is unrelated to this.

1 Answer 1

1

A common issue that may be causing this is you may have another node running already, perhaps in another terminal window. That another node will have taken the default port assigned to the node, so when you try to connect to this node, it is unable to do so.

To determine if this is the case, examine the logs for this current node in your terminal, and specifically look for the http address and port allocation on your localhost.

If it is assigned to the default port of 9933, you will see the following:

Running JSON-RPC HTTP server: addr=127.0.0.1:9933, allowed origins=["*"]

If it has been assigned a different port, take note of it. Once you have it, you can open up https://polkadot.js.org/apps and click on the circle icon on the top left-hand of the navigation.

circle icon to show the Polkadot JS navigation menu.

Then, enter the correct port in the "custom endpoint" text box.

enter image description here

Finally, click "Switch" on the upper right-hand corner of the navigation menu.

You should now be connected to your local node.

As an aside, it's a good idea to also confirm the presence of any other active running nodes on your machine, and if not needed, to shut them down.

1
  • 2
    Thanks for the detailed explanation! It solved my problem, I was running another node and completely forgot about it Jan 23, 2023 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.