First off, I’m using https://www.snowpack.dev/ and not Webpack, so I am not bundling everything into one file.
A problem I have run into is that dfx deploy is ignoring hidden directories inside of asset canister upload directories. It will not upload them to the canister. This is causing problems for me when using Snowpack, messing up my import aliases, as I have to alias into the .dfx directory, which is technically hidden. Snowpack takes this directory and potentially builds it and puts it into my asset canister upload directory.
I think it’s unexpected that dfx deploy would ignore hidden directories. For example, git does not ignore hidden directories unless you explicitly ignore those directories. I would expect all directories and files in the asset canister upload directory to be uploaded to the directory, and perhaps to have some sort of ignore configuration for everything else.
We’ve got a proposal to add a command to dfx that will generate the interface files and output them into your source code specifically for a nicer setup with bundlers like snowpack.
Yeah, I can see that going either way. The consequences of accidentally publishing something that was deliberately made secret seem to be a worse outcome to me, personally
Another alternative is a way to override that…something like .gitignore, with git nearly everything is included by default and then you specifically exclude. Even if dfx excluded some things by default and allowed the user to explicitly include, that would be nice. But right now there is not way to control that
Has this issue been resolved? I’m running into a similar problem. I use SvelteKit to build a website. I have two hidden files .well-known/ic-names and .ic-assets.json in the output directory that’s defined as the source in dfx.json. Every other file in the source directory gets picked up by dfx deploy except these two hidden files (which are needed to configure custom domain name for my site). It seems that dfx doesn’t process hidden files? Is there a way to impose that?
This issue surfaced when @rikonor was helping me figure out how to set up the custom domain.
I did whitelist both files in the static folder of SvelteKit. Both files can persist in the final output directory that SvelteKit renders via npm run build. However, dfx deploy somehow didn’t pick up these two files and didn’t upload them to the canister (every other file got picked up just fine).
Does any asset in herbertyang/static/ get uploaded? I suspect you simply haven’t told dfx to include that folder. In that case you’d have to change dfx.json’s definition of the canister sources like this:
I just tried that, by adding herbertyang/static as another path in “source” in dfx.json. After running npm run build and dfx deploy --network=ic --no-wallet, the result is still the same though. It says, “domain is missing from canister xxx”.
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 500
< server: nginx/1.21.3
< date: Wed, 22 Feb 2023 00:27:20 GMT
< content-length: 81
< access-control-allow-origin: *
< access-control-allow-methods: HEAD, POST
< access-control-allow-credentials: true
< access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-None-Match,If-Modified-Since,Cache-Control,Content-Type,Range,Cookie
< access-control-expose-headers: Accept-Ranges,Content-Length,Content-Range
< access-control-max-age: 600
<
* Connection #0 to host ic0.app left intact
domain is missing from canister hbc6w-gqaaa-aaaag-aagdq-cai list of known domains
@rikonor helped me investigate this error message yesterday and confirmed that it was because the two hidden files, .well-known/ic-domains and .ic-assets.json were not uploaded to the canister. From dfx’s execution messages, I can also tell that every other file in herbertyang/build and herbertyang/static was uploaded, except for these two.
Found the issue. My dfx version was too told (duh … ). I upgraded dfx from the original 0.9.2 to 0.12.1 => fixed the (new) issue with the canister principal (not a problem in the older version of dfx) => removed herbertyang/static from source in dfx.json (new dfx screams for sync error … not a problem in the older dfx) => the rest was a breeze.
My site is now live at https://herbertyang.xyz . No more funky https://hbc6w-gqaaa-aaaag-aagdq-cai.raw.ic0.app .
Thank you @samshi@rikonor@Severin@peterparker for helping me narrow down the problems, isolated other issues, and identified the fix! Much appreciated.
Also a valudable feedback for my personal project. With Juno I took another approach. Everything in static is deployed unless developer ignores explicitely resources. In addition, the ic-domain is automatically generated. So both issues you faced would have not find place .
Before, I encountered the same error as Herbert: “domain is missing from canister kqlfj-siaaa-aaaag-aaawq-cai list of known domains.” However, I found that I just needed to include the .ic-assets.json and .well-known files in the build. I am now able to download the file at https://kqlfj-siaaa-aaaag-aaawq-cai.ic0.app/.well-known/ic-domains. However, I am now facing an “unexpected error.” I am not sure if anyone else has encountered this issue. Using google domains.