dfinity / linkedup

An open professional network.
https://sdk.dfinity.org
Apache License 2.0
154 stars 43 forks source link

No CSS/JS loaded when viewing asset canister #62

Open stephenplusplus opened 3 years ago

stephenplusplus commented 3 years ago

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!

u6768 commented 3 years ago

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