Invalid Signatures When Running Local Canisters with Internet Identity
Setup Details:
- DFX Version:
0.25.0
- DFX Network:
local
- Frontend & Backend Canisters: Deployed locally
- Additional Setup: Running
sns-testing
repo simultaneously (which works fine with Internet Identity)
Issue:
I deployed my frontend and backend canisters locally for testing. When I run npm run dev
to interact with my frontend, I get console errors indicating invalid canister signatures
when communicating with my backend canister and Internet Identity (II).
Despite this issue, the sns-testing
repo runs fine with II on the same setup.
Has anyone encountered this issue before? Any insights on resolving the invalid signature errors when using II locally?
Thanks in advance!
Internet Identity uses canister signatures which are only valid in the same network as the canister. Which means mainnet Internet Identity cannot be used on a local network.
You’ll need to locally deploy Internet Identity to use it with local canisters, see: Integrating Internet Identity | Internet Computer
I have a local II running locally and my frontend too is provided with its url..
Still it doesn’t seem to work
Are the Internet Identity canister and backend canisters you’re calling on the same DFX network (dfx.json)?
They are not in the same dfx.json but they are running in the same replica of ic locally. Since I am testing it along with the sns
Any chance you can share the code setup? (Either publicly on GitHub or privately by DM)
John has shared this privately - @peterparker this signature thing sometimes happens dunno if you know a way to clear it
To my knowledge, common mistakes when dealing with signature issues during local development include:
- Forgetting to enable “should use root key” when creating the agent.
- Using an identity that was created in production to make a local call—for example, switching between
npm run dev
environments without clearing your cache. You can usually verify this by testing in a clean incognito window.
Could it be one of these two?
1 Like
Thank you David we will give these a try and confirm.
1 Like