D
Deno

help

Using dynamic import with npm compatibility gives intermittent error "__DENO_NODE_GLOBAL_THIS_167935

Ttmcw3/21/2023
This is pretty hard to google because the number at the end of the error changes everytime it happens, but basically: is this a known issue? I'll run some code (in a worker, using dynamic import pointing to npm: or a CDN and get ReferenceError: __DENO_NODE_GLOBAL_… on the first and sometimes second run, but after that it'll work.
Bbartlomieju3/21/2023
@tmcw that's definitely a bug! Could you provide some kind of reproduction? I have a feeling I know what's the issue, but I need a test case to pin point it
Ttmcw3/21/2023
Sure, I think I can do that
Ttmcw3/21/2023
Gist
repro.ts
GitHub Gist: instantly share code, notes, and snippets.
Ttmcw3/21/2023
This produces
error: Uncaught (in promise) ReferenceError: __DENO_NODE_GLOBAL_THIS_1679440099__ is not defined
at file:///Users/tmcw/Library/Caches/deno/npm/registry.npmjs.org/simple-statistics/7.8.2/dist/simple-statistics.mjs:1:18
error: Uncaught (in promise) ReferenceError: __DENO_NODE_GLOBAL_THIS_1679440099__ is not defined
at file:///Users/tmcw/Library/Caches/deno/npm/registry.npmjs.org/simple-statistics/7.8.2/dist/simple-statistics.mjs:1:18
okay, works for dynamic & static imports - the importing from a data url appears to be the cause tracked the internals down to https://github.com/denoland/deno/blob/7d9653d51fb0c4d3844f61e1214b6bddc50d2cef/ext/node/lib.rs#L401 - not like that's the cause okay i think i found a workaround - if you import something from npm on the top level before you import something from npm in an import, then it works filed a bug with the repro: https://github.com/denoland/deno/issues/18343
Bbartlomieju3/22/2023
thanks! yeah, that was exactly what I expected - we only initialize the node runtime if we discover the NPM dependency but data URLs were definitely missed on this I'll try to fix it before tomorrow's release, but no promises 🤞

Looking for more? Join the community!

Recommended Posts
Graphql codegendoes anyone have a solution to generate the sdk using graphq-request with Deno?Deno Third Party Modules Web HooksIs there a way to see the webhook payload URL a package you have published is listening for?Does Deno Deploy support location based analytics?The free version does not seem to support it. Does the paid version support it?IPC solution for a process manager👋 I'm at day 7 of working on Pup (https://github.com/hexagon/pup) - a universal process manager rSpecifying config remotely or jsx on installI'm struggling quite a lot here. I originally recommended using this command: ```bash deno install -Is it possible to know what version of a dynamically-imported module was just imported?Right now, you can run code like `import('npm:lodash')`, which will get the latest version of lodashWhy am I getting an "Uncaught DOM Exception" in the Deno CLI?To replicate: 1. `deno` in the command line to initialize a Deno REPL ``` // Get an array of random Better way to allow downloading of files besides serving entire fileI'm trying to allow users to download files that are in a private folder which cannot be accessed puShare state between islandsHi. How could I share state between island. E.g. shopping cart. I click on add product and in some oIslands not working with Cloudflare DNS proxyI have deployed Deno on a remote server with nginx-ingress-controller that offers self-signed certifUpdate sub-directory for module already added to deno.land/xThe title pretty much says it all, but the module in question is `hot_mod`, and the current subdir iShould we, or how should we, use Deno as a sandbox for untrusted code?I've been using Deno in this context because of some of the nice security model features. However, ideno_bindgen type error: deno-ts(2345)Anyone else getting this with `deno_bindgen`? > Argument of type 'bigint' is not assignable to paramUsing Rust FFI in a public Deno moduleI'm writing a Deno module that I intend to publish on deno.land. It will be using a Rust library (puPublishing to deno.land/x: GitHub webhook says it's delivered?I followed these directions (https://deno.land/add_module) to publish a 3rd party module to deno.lanDeno tsWhenever i run my deno file using a ts config like this documentation describes: https://deno.land/Nvim deno tsserver conflictmy language servers are conflicting when i open a deno project, if i use `LspInfo` i can see both deDeno Docker - deno run --watch file.tsI am on a macbook m1, and i tried to dockerize deno from the official image and whenever i try doingWebSocket subprotocolsThis might be a bug: Deno's websocket implementation seems to have issues with [subprotocols](https:How can I create a linked [ReadableStream,WritableStream] pair?Hi, I have a function A which accepts a WritableStream and another function B which accepts a Readab