"404 Not Found" error when attempting to deploy to network

When I was developing before Genesis, I could use the following command, which would create my canisters on the actual network (i.e. accessible over the internet, not just locally a locally running dfx start instance):

dfx deploy --network ic

But now when I run that command, I get the following error:

Creating canisters...
Creating canister "my_canister"...
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "", content: Requested canister does not exist

Of course the canister doesn’t exist on the network; I’m trying to deploy it there for the first time.

Possibly this is because I haven’t bought any cycles? If that’s it, the error could be a little more helpful. If that’s not it, I’d love to figure out what is! I need to test my app on the actual internet, and I’d love to be able to do that without paying for cycles but I will if necessary.

Also, at one point I was given a Sodium wallet canister that was pre-loaded with
cycles. Are those usable in a post-genesis world? Is there another way to get cycles that can be used for testing?

try this:

1 Like

Ok, thanks @flyq. I’m going through the tutorial and I’m still getting a 404 error when trying to deploy, even though I’ve set the www>ic canister id to my nns canister that is properly loaded with Cycles.

dfx deploy --network ic --no-wallet                      ⏎ ✖ ✹ ✭
Deploying all canisters.
Creating canisters...
Creating canister "serve"...
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.19.10</center>
</body>
</html>

The tutorial had me edit canister_ids.json in the project root, but that file didn’t exist so I created it and entered in the proper information.

Any ideas why I might be getting this 404 error when trying to deploy?

Generally that’s because you’re on a pre-genesis build of dfx

1 Like

I’m on 0.7.2, the latest. That’s the version of dfx that I used to create the project too.

try

dfx start --clean

to clear cache and then try for once.

1 Like

I’m still getting the 404 error after starting dfx with dfx start --clean.

If I delete the contents of canister_ids.json and try to do a deploy with dfx deploy --network ic --no-wallet, it says Cannot decode contents of file at 'canister_ids.json', so I know it’s looking at that file. But if I replace the contents with any other valid json, I get the above 404 error. I have a feeling dfx is not properly reading my canister id from the file, as I get the same error whether I replace the canister id with a nonsense string or replace the whole file with {}.

The contents of my canister_ids.json file is exactly as specified in the tutorial:

{
    "www": {
        "ic": "mvjun-2yaaa-aaaah-aac3q-cai"
    }
}

:man_facepalming:

“www” was the name of the canister in the tutorial. I though it was some special name for deploying to the network IC. I replaced it with the name of my canister and I was able to successfully deploy!

I’m now getting back Body does not pass verification when I refresh the page at mvjun-2yaaa-aaaah-aac3q-cai.ic0.app, but at least I was able to deploy!

Thanks for the help, sorry for my dumb mistake.

1 Like

No need to apologize for a dumb mistake - that’s 99% of what we all do every day! I wonder if we can come up with a better error message for this situation

1 Like

I ran into this error while doing local development. Can someone suggest any fixes for this?

can you paste complete error here.