Help Required facing error running my app on localhost please help!

Hello Everyone!!

I’m new to dfinity and started working recently but stuck at one issue.
ICP backend and frontend canister url running well after I ran dfx deploy.
Please refer the screen shot.

Frontend:

Candid UI:

Both is working but if I run dfx deploy and then try to do npm start then my browser asks credentials & I’m unable to proceed. As a result my code written to connect backend to frontend I’m not able to verify.
refer below screenshot of terminal & issue.


If I run npm start in new terminal without dfx deploy then it is creating new localhost 8081 and I’m not facing issue to load the url in browser. But this url do not connect with ICP code.

Please help as I’m not sure how to resolve this.


Can you explain why you want to run npm start after dfx deploy? You can see the frontend on the local chain, so why would you also want to npm start?

I tried few things and then realized since my index.js and main.css had comments at start due to which may be when I used frontend url then my css did not load properly. Also did not observed any connection between frontend and backend as data was not getting pulled from the backend.

I’m new to ICP & dfinity so I’m referring to some tutorial online and as per that dfx deploy must be followed by npm start to get the localhost url.

Even the blog I referred talks about npm start to deploy dapp locally.

but now my issue is fixed thanks :slight_smile:

1 Like

:person_facepalming: npm start is simply unnecessary. dfx deploy takes care of it all. I’ll remove it from the tutorial.

As a next step I would like to deploy app to IC but just received below message from discord.
ICP
If anyone with foundation role can dm me the coupon at my id: @nomad0109

Hi sir,
I just started exploring ICP when I started my first dapp and give my name to it and pressed the “click me button” it is giving this error

Server returned an error:
Code: 400 (Bad Request)
Body:

AgentError: Server returned an error:
Code: 400 (Bad Request)
Body:

at HttpAgent._HttpAgent_requestAndRetry (http://localhost:8080/index.js:1352:11)
at async HttpAgent._HttpAgent_requestAndRetry (http://localhost:8080/index.js:1350:16)
at async HttpAgent._HttpAgent_requestAndRetry (http://localhost:8080/index.js:1350:16)
at async HttpAgent._HttpAgent_requestAndRetry (http://localhost:8080/index.js:1350:16)
at async Promise.all (index 0)
at async HttpAgent.call (http://localhost:8080/index.js:925:43)
at async caller (http://localhost:8080/index.js:265:61)
at async HTMLFormElement.<anonymous> (http://localhost:8080/index.js:22558:20)

dfx changed the default port to 4943 a while ago. Are you really running the replica on 8080?