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

Failed to run - ipfs-core & helia due to {current throwing dependency} #562

Open
jcc10 opened this issue Mar 23, 2023 · 16 comments
Open

Failed to run - ipfs-core & helia due to {current throwing dependency} #562

jcc10 opened this issue Mar 23, 2023 · 16 comments
Labels
deno Not working in Deno

Comments

@jcc10
Copy link
Contributor

jcc10 commented Mar 23, 2023

IPFS

This is the one I eventually want to use... Eventually.

Current throwing dep: undici

This is the one I eventually want to use... Eventually.

import { request as undiciRequest} from "http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs";

Error message

After running deno run I got this:

✅ Granted all env access.
error: Uncaught TypeError: Class extends value undefined is not a constructor or null
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:3:16310
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:2:2114
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:5:374
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:2:2114
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:5:3554
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:2:2114
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:45:8659
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:2:2114
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:45:77525
    at http://127.0.0.1:8080/v113/undici@5.21.0/deno/undici.mjs:2:2114

Additional info

  • esm.sh version: 3b37383
  • Deno version: 1.32.1
@jcc10 jcc10 added the deno Not working in Deno label Mar 23, 2023
@jcc10
Copy link
Contributor Author

jcc10 commented Mar 23, 2023

I'm gonna start to work on helia (the "successor" to IPFS-core) while this one is stewing.

@jcc10 jcc10 changed the title Failed to run - ipfs-core due to default-gateway Failed to run - ipfs-core & helia due to default-gateway Mar 23, 2023
@jcc10
Copy link
Contributor Author

jcc10 commented Mar 23, 2023

So... turns out helia also relies on default-gateway. So that's neat.

#561 is also required for helia to work.

@jcc10
Copy link
Contributor Author

jcc10 commented Mar 23, 2023

Manual edit of

x=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,s)=>(typeof require<"u"?require:r)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});

to

x=(x=>{return import(x)});

Fixed the issue, though I'm not sure if this is really feasible to fix here or if it should be fixed in the module... I'll look into it.

Opening new issue for the next roadblock I found.

@ije
Copy link
Member

ije commented Mar 23, 2023

does #561 fix this?

@jcc10
Copy link
Contributor Author

jcc10 commented Mar 23, 2023

Sorry for spam but it turns out that it is just a normal dynamic require on the side of default-gateway, so this is actually something in the transpiler pipeline.

Had I done a bit more searching I would have found #368 which is the same error.

It looks like this is a problem in esbuild itself as it has bug reports of this message.

It may need to be a regex rewrite where if a module is flagged as having a dynamic require it gets the require statement overwritten with a dynamic import. However this would also effect code maps so that should be taken into account.

#561 does not fix this but is required to get far enough for this error to occur. (and once this error is fixed there is at least one more after it.)

@ije
Copy link
Member

ije commented Mar 23, 2023

i see, i will look into it. thanks !

@ije
Copy link
Member

ije commented Mar 23, 2023

Screenshot 2023-03-24 at 06 14 36

comfirms your PR #561 fixed xml2js and netmask deps, i am looking into default-gateway problem

@ije
Copy link
Member

ije commented Mar 24, 2023

Screenshot 2023-03-24 at 18 14 47

after some dig-in works, i found there is a dynamic require in this package

@ije
Copy link
Member

ije commented Mar 24, 2023

damn, the deps of ipfs is so crazy....

@ije ije closed this as completed in b053ac2 Mar 24, 2023
@ije
Copy link
Member

ije commented Mar 24, 2023

trying to fix @achingbrain/nat-port-mapper which actually throws the Dynamic require and createRequire only supports errors

@ije ije reopened this Mar 24, 2023
@ije
Copy link
Member

ije commented Mar 24, 2023

Screenshot 2023-03-24 at 22 05 07

i gave up, seems `ipfs-core` is not compatible with deno

@jcc10
Copy link
Contributor Author

jcc10 commented Mar 28, 2023

I'll take a look at the work you did and try to continue it.

@jcc10 jcc10 changed the title Failed to run - ipfs-core & helia due to default-gateway Failed to run - ipfs-core & helia due to {current throwing dependency} Mar 28, 2023
@jcc10
Copy link
Contributor Author

jcc10 commented Mar 28, 2023

Current error is with undici that seems to be some unknown class it's trying to extend. Doing research now.

@jcc10
Copy link
Contributor Author

jcc10 commented Mar 28, 2023

Is there a option for non-minified files? Or does anyone know a way to view code with a source map?

If no one has any good ideas I'm gonna have to build my own.

@ije
Copy link
Member

ije commented Mar 28, 2023

Is there a option for non-minified files? Or does anyone know a way to view code with a source map?

If no one has any good ideas I'm gonna have to build my own.

use ?dev

@jcc10
Copy link
Contributor Author

jcc10 commented Mar 30, 2023

SNIP: Moved to a new bug for tracking, once that is done will continue working here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno Not working in Deno
Projects
None yet
Development

No branches or pull requests

2 participants