Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dfx 0.7.0-beta.2 does not allow ES modules #1590

Closed
ililic opened this issue Apr 12, 2021 · 3 comments
Closed

Dfx 0.7.0-beta.2 does not allow ES modules #1590

ililic opened this issue Apr 12, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@ililic
Copy link

ililic commented Apr 12, 2021

From lastmjs on the forum:

anytime I try to load an ES module, for example like this:

<html>
    <head>
    </head>

    <body>
    </body>
</html>

I get the following error in the browser:

Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

I’ve created a simple http proxy server on my local machine to try and get around the problem described above. If I explicitly set the Content-Type response header to application/json, then I can get a top level ES module to load. But the dependencies of that top level module will not load, the replica seems to always return 500 errors.

As I’ve dug into it, it looks like the http requests made from an ES module do not carry any information about the canisterId from the original URL. Other requests have the canisterId in the Referrer request header, but the referrer of in the http requests from an ES module does not have the canisterId in it. Could that be the problem? I’m not sure how the replica will be able to understand which canister it is servers assets for without providing the canisterId somehow.

@ililic ililic added the bug Something isn't working label Apr 12, 2021
@peterpeterparker
Copy link
Member

peterpeterparker commented Oct 22, 2021

I had trouble with the simulated network and ES modules too (see sample repo).

Solution is using http://<canister_id>.localhost:8000/ instead of http://localhost:8000/?canisterId=<canister_id> so that urls can be resolved.

It might solve this issue too. If yes, might be worth documenting it.

@sesi200
Copy link
Contributor

sesi200 commented Oct 4, 2022

Since this references 0.7.0 I'm considering this outdated. If this is still an issue feel free to reopen.

@sesi200 sesi200 closed this as completed Oct 4, 2022
@peterpeterparker
Copy link
Member

peterpeterparker commented Oct 4, 2022

I am guessing it is not outdated and probably still fails but, I gave up using http://localhost:8000/?canisterId=<canister_id> a long time ago.

dfinity-bot added a commit that referenced this issue Feb 8, 2023
## Changelog for advisory-db:
Branch: main
Commits: [rustsec/advisory-db@bb92d2d5...b485cf4d](rustsec/advisory-db@bb92d2d...b485cf4)

* [`58e20bb7`](rustsec/advisory-db@58e20bb) Add CVE-2023-0286 for openssl-src ([RustSec/advisory-db⁠#1573](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1573))
* [`56f79c7b`](rustsec/advisory-db@56f79c7) Assigned RUSTSEC-2023-0006 to openssl-src ([RustSec/advisory-db⁠#1574](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1574))
* [`a0530f10`](rustsec/advisory-db@a0530f1) Add CVE-2022-4304 for openssl-src ([RustSec/advisory-db⁠#1575](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1575))
* [`d70e7f95`](rustsec/advisory-db@d70e7f9) Assigned RUSTSEC-2023-0007 to openssl-src ([RustSec/advisory-db⁠#1576](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1576))
* [`4bf8b4c3`](rustsec/advisory-db@4bf8b4c) Add CVE-2022-4203 for openssl-src ([RustSec/advisory-db⁠#1577](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1577))
* [`8d1c5992`](rustsec/advisory-db@8d1c599) Assigned RUSTSEC-2023-0008 to openssl-src ([RustSec/advisory-db⁠#1578](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1578))
* [`818cdec0`](rustsec/advisory-db@818cdec) Add CVE-2023-0215 for openssl-src ([RustSec/advisory-db⁠#1579](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1579))
* [`b324cf92`](rustsec/advisory-db@b324cf9) Assigned RUSTSEC-2023-0009 to openssl-src ([RustSec/advisory-db⁠#1581](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1581))
* [`1445e637`](rustsec/advisory-db@1445e63) Add CVE-2022-4450 for openssl-src ([RustSec/advisory-db⁠#1580](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1580))
* [`94fdfaf7`](rustsec/advisory-db@94fdfaf) Assigned RUSTSEC-2023-0010 to openssl-src ([RustSec/advisory-db⁠#1585](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1585))
* [`3e3631fd`](rustsec/advisory-db@3e3631f) Add CVE-2023-0216 for openssl-src ([RustSec/advisory-db⁠#1582](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1582))
* [`19c2e8af`](rustsec/advisory-db@19c2e8a) Assigned RUSTSEC-2023-0011 to openssl-src ([RustSec/advisory-db⁠#1586](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1586))
* [`3cfb8970`](rustsec/advisory-db@3cfb897) Add CVE-2023-0217 for openssl-src ([RustSec/advisory-db⁠#1583](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1583))
* [`daa52cad`](rustsec/advisory-db@daa52ca) Assigned RUSTSEC-2023-0012 to openssl-src ([RustSec/advisory-db⁠#1587](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1587))
* [`0f3d1597`](rustsec/advisory-db@0f3d159) Add CVE-2023-0401 for openssl-src ([RustSec/advisory-db⁠#1584](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1584))
* [`feb5cddd`](rustsec/advisory-db@feb5cdd) Assigned RUSTSEC-2023-0013 to openssl-src ([RustSec/advisory-db⁠#1588](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1588))
* [`c6193701`](rustsec/advisory-db@c619370) Add advisory aliyun-oss-client ([RustSec/advisory-db⁠#1589](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1589))
* [`8a1400e3`](rustsec/advisory-db@8a1400e) Assigned RUSTSEC-2022-0089 to aliyun-oss-client ([RustSec/advisory-db⁠#1590](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1590))
* [`cb6cfde9`](rustsec/advisory-db@cb6cfde) Update RUSTSEC-2020-0071.md ([RustSec/advisory-db⁠#1591](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1591))
* [`b485cf4d`](rustsec/advisory-db@b485cf4) Update RUSTSEC-2020-0071.md ([RustSec/advisory-db⁠#1594](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1594))
mergify bot pushed a commit that referenced this issue Mar 4, 2023
## Changelog for advisory-db:
Branch: main
Commits: [rustsec/advisory-db@bb92d2d5...b485cf4d](rustsec/advisory-db@bb92d2d...b485cf4)

* [`58e20bb7`](rustsec/advisory-db@58e20bb) Add CVE-2023-0286 for openssl-src ([RustSec/advisory-db⁠#1573](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1573))
* [`56f79c7b`](rustsec/advisory-db@56f79c7) Assigned RUSTSEC-2023-0006 to openssl-src ([RustSec/advisory-db⁠#1574](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1574))
* [`a0530f10`](rustsec/advisory-db@a0530f1) Add CVE-2022-4304 for openssl-src ([RustSec/advisory-db⁠#1575](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1575))
* [`d70e7f95`](rustsec/advisory-db@d70e7f9) Assigned RUSTSEC-2023-0007 to openssl-src ([RustSec/advisory-db⁠#1576](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1576))
* [`4bf8b4c3`](rustsec/advisory-db@4bf8b4c) Add CVE-2022-4203 for openssl-src ([RustSec/advisory-db⁠#1577](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1577))
* [`8d1c5992`](rustsec/advisory-db@8d1c599) Assigned RUSTSEC-2023-0008 to openssl-src ([RustSec/advisory-db⁠#1578](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1578))
* [`818cdec0`](rustsec/advisory-db@818cdec) Add CVE-2023-0215 for openssl-src ([RustSec/advisory-db⁠#1579](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1579))
* [`b324cf92`](rustsec/advisory-db@b324cf9) Assigned RUSTSEC-2023-0009 to openssl-src ([RustSec/advisory-db⁠#1581](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1581))
* [`1445e637`](rustsec/advisory-db@1445e63) Add CVE-2022-4450 for openssl-src ([RustSec/advisory-db⁠#1580](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1580))
* [`94fdfaf7`](rustsec/advisory-db@94fdfaf) Assigned RUSTSEC-2023-0010 to openssl-src ([RustSec/advisory-db⁠#1585](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1585))
* [`3e3631fd`](rustsec/advisory-db@3e3631f) Add CVE-2023-0216 for openssl-src ([RustSec/advisory-db⁠#1582](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1582))
* [`19c2e8af`](rustsec/advisory-db@19c2e8a) Assigned RUSTSEC-2023-0011 to openssl-src ([RustSec/advisory-db⁠#1586](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1586))
* [`3cfb8970`](rustsec/advisory-db@3cfb897) Add CVE-2023-0217 for openssl-src ([RustSec/advisory-db⁠#1583](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1583))
* [`daa52cad`](rustsec/advisory-db@daa52ca) Assigned RUSTSEC-2023-0012 to openssl-src ([RustSec/advisory-db⁠#1587](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1587))
* [`0f3d1597`](rustsec/advisory-db@0f3d159) Add CVE-2023-0401 for openssl-src ([RustSec/advisory-db⁠#1584](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1584))
* [`feb5cddd`](rustsec/advisory-db@feb5cdd) Assigned RUSTSEC-2023-0013 to openssl-src ([RustSec/advisory-db⁠#1588](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1588))
* [`c6193701`](rustsec/advisory-db@c619370) Add advisory aliyun-oss-client ([RustSec/advisory-db⁠#1589](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1589))
* [`8a1400e3`](rustsec/advisory-db@8a1400e) Assigned RUSTSEC-2022-0089 to aliyun-oss-client ([RustSec/advisory-db⁠#1590](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1590))
* [`cb6cfde9`](rustsec/advisory-db@cb6cfde) Update RUSTSEC-2020-0071.md ([RustSec/advisory-db⁠#1591](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1591))
* [`b485cf4d`](rustsec/advisory-db@b485cf4) Update RUSTSEC-2020-0071.md ([RustSec/advisory-db⁠#1594](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1594))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants