linkedup icon indicating copy to clipboard operation
linkedup copied to clipboard

No CSS/JS loaded when viewing asset canister

Open stephenplusplus opened this issue 4 years ago • 1 comments

Hello 👋🏻

I've been trying to get this running, following the README, but when I get to the final step to view the built asset canister, it doesn't load any JavaScript or CSS files. I dug through the .dfx folder to see that a few CSS/JS files made it in there. I'm still new to how dfinity apps are meant to be built and run, so I tried a hacky solution to get "index.css" and "index.js" inserted into the page (by adding link/script tags to src/linkedup/public/index.html). Rebuilding and reinstalling to the canister got them to load in the browser, but a new error emerged:

index.js:2 Uncaught TypeError: Cannot read property 'retrieve' of undefined
    at Module.<anonymous> (index.js:2)
    at r (index.js:2)
    at index.js:2
    at index.js:2

That maps to the minified version of main.js:

    (void 0).retrieve("index.html")

Which is: https://github.com/dfinity/linkedup/blob/b5c61e859b90bceac3468d37e675f96f1c9aa956/src/linkedup/public/main.js#L23-L24

I have a feeling since I'm improperly including the js file, it didn't get properly processed to load what ended up being void 0. In any case, it was time for me to stop guessing and see if anyone could help get me started :)

Thank you for your time and help!

stephenplusplus avatar May 15 '21 20:05 stephenplusplus

I ran into same issue with latest dfx version and noticed this LinkedUp project actually uses old 0.6.22 version in dfx.json. The dfinity doc site has a specific page explaining breaking changes regarding assets canister before and after 0.7.0.

Introducing a new approach to handling HTTP requests and serving assets

After downgrading dfx to expected 0.6.22, it worked to load page correctly with CSS / JS. Please check out this official doc link for details to install specific dfx version.

Install a specific version from a terminal

u6768 avatar Jun 05 '21 13:06 u6768