deno
deno copied to clipboard
`node:http2` doesn't export `Http2ServerRequest` and `Http2ServerResponse`
Discussed in https://github.com/denoland/deno/discussions/23324
Originally posted by OnielN14 April 11, 2024 In the v1.42.2 I see latest compat update for node http2 is released. So I just try to run hono + @hono/node-server
import { serve } from "npm:@hono/node-server"
import { Hono } from "npm:hono"
const app = new Hono()
app.get("/", (c) => c.text("Hello from server"))
serve({
fetch: app.fetch,
port: 3000
}, () => {
console.log("Running on 3000")
})
and it seems Http2ServerRequest is not available as named export.
here is the error message
error: Uncaught SyntaxError: The requested module 'http2' does not provide an export named 'Http2ServerRequest'
at <anonymous> (file:///C:/Users/OnielN14/AppData/Local/deno/npm/registry.npmjs.org/@hono/node-server/1.9.1/dist/index.mjs:5:10)
am I missing something regarding node compatiblity?
Thanks
No particular reason, it's a bug.
Just exporting these two classes (here and here) won't make it work. The response here will be empty
That's correct, @satyarohith is working on improving node:http2 module.
@bartlomieju Is this issue still open? I mean can I work on this? Is not entirely clear based on your last comment.
If so, I would like to give it a stab c:
@bartlomieju Is this issue still open? I mean can I work on this? Is not entirely clear based on your last comment.
If so, I would like to give it a stab c:
Hi, @jmj0502. Please go ahead. Note https://github.com/denoland/deno/issues/23326#issuecomment-2056651490
@satyarohith cool!
Quick question? Should I work on the implementation describe on the initial consideration of the issue? or are there other changes to be considered for the issue in question? 🤔
@satyarohith cool!
Quick question? Should I work on the implementation describe on the initial consideration of the issue? or are there other changes to be considered for the issue in question? 🤔
A good target is to get the example from description working with Deno. Exporting the unavailable methods isn't sufficient to get it working as mentioned here. I'm not entirely sure what exactly is required to get the example to work with Deno. We need to explore why the response is empty and what needs to be done. The scope of it has increased after https://github.com/denoland/deno/issues/23326#issuecomment-2056651490 and I don't think it's a good first issue anymore. But I'm happy to help (You can send me Discord DM) if you're interested to dig deeper. :)
A good target is to get the example from https://github.com/denoland/deno/issues/23326#issue-2238489014 working with Deno. Exporting the unavailable methods isn't sufficient to get it working as mentioned https://github.com/denoland/deno/issues/23326#issuecomment-2056651490. I'm not entirely sure what exactly is required to get the example to work with Deno. We need to explore why the response is empty and what needs to be done. The scope of it has increased after https://github.com/denoland/deno/issues/23326#issuecomment-2056651490 and I don't think it's a good first issue anymore. But I'm happy to help (You can send me Discord DM) if you're interested to dig deeper. :)
@satyarohith Cool! I'm all up for it! Many thanks for offering your help, again I don't really know the codebase in depth, but I'll do my best to fix the issue in question.
I'll start by building the project and replicating the issue in question, then I'll proceed to send you a discord DM to further explain my plan of action and start diving deeper into the issue. Feel free to assign the issue to me if you consider it appropriate 👍
I also encountered the same issue
I'm also experiencing a similar issue with the Astro adapter.
PS C:\Users\user.name\Source\project\packages\web\frontend> npm run build
> [email protected] build
> astro build
The requested module 'node:http2' does not provide an export named 'Http2ServerResponse' at file:///C:/Users/user.name/Source/project/node_modules/.deno/[email protected]/node_modules/astro/dist/vite-plugin-astro-server/response.js:1:10
Stack trace:
at async runCommand (file:///C:/Users/user.name/Source/project/node_modules/.deno/[email protected]/node_modules/astro/dist/cli/index.js:146:25)
npm error Lifecycle script `build` failed with error:
npm error code 1
npm error path C:\Users\user.name\Source\project\packages\web\frontend
npm error workspace [email protected]
npm error location C:\Users\user.name\Source\project\packages\web\frontend
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c astro build
PS C:\Users\user.name\Source\project\packages\web\frontend>
@und-miller what deno version are you using? can you upgrade to the latest version and try again?
@und-miller make sure you're using the latest Deno release. This problem was fixed just a few weeks ago.
Thank you for the quick reply. I was indeed running an older version of Deno. After upgrading the problem went away.