Comments (5)
Hi @Code-Hex
Which version of @hono/vite-dev-server
are you using?
from vite-plugins.
I'm using 0.8.0. I am also investigating.
I'm sorry, I made a mistake in the order of describing the issues in the ticket. Actually, the error occurs due to the following problem.
The error in the title of this issue occurs when the following code is commented out.
vite-plugins/packages/dev-server/src/dev-server.ts
Lines 158 to 163 in 81d8e18
There are two issues. The one I initially wrote and the Internal server error: Unknown error: [object Response]
issue. The issue I wrote initially occurs after resolving the Unknown error: [object Response]' problem.
I also suspect that the fetch
client being called within app.fetch
is the cause. The object returned by this client is a Response object, but it is not captured by the instanceof
part, resulting in an error. I added lines:
if (!(response instanceof Response)) {
console.log(new Response(null, 200), response)
throw response;
}
and below is the output it generates.
_Response [Response] {} Response {
[Symbol(realm)]: null,
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 200,
timingInfo: {
startTime: 3204.850082397461,
redirectStartTime: 0,
redirectEndTime: 0,
postRedirectStartTime: 3204.850082397461,
finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 0,
finalNetworkRequestStartTime: 0,
endTime: 0,
encodedBodySize: 435,
decodedBodySize: 435,
finalConnectionTimingInfo: null
},
cacheState: '',
statusText: 'OK',
headersList: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
urlList: [ URL {} ],
body: { stream: undefined }
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(7) {
'date' => [Object],
'content-type' => [Object],
'content-length' => [Object],
'connection' => [Object],
'server' => [Object],
'access-control-allow-origin' => [Object],
'access-control-allow-credentials' => [Object]
},
[Symbol(headers map sorted)]: null
}
}
Response {
[Symbol(realm)]: null,
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: true,
requestIncludesCredentials: true,
type: 'default',
status: 200,
timingInfo: {
startTime: 3204.850082397461,
redirectStartTime: 0,
redirectEndTime: 0,
postRedirectStartTime: 3204.850082397461,
finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 0,
finalNetworkRequestStartTime: 0,
endTime: 0,
encodedBodySize: 435,
decodedBodySize: 435,
finalConnectionTimingInfo: null
},
cacheState: '',
statusText: 'OK',
headersList: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
urlList: [ URL {} ],
body: { stream: undefined }
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(7) {
'date' => [Object],
'content-type' => [Object],
'content-length' => [Object],
'connection' => [Object],
'server' => [Object],
'access-control-allow-origin' => [Object],
'access-control-allow-credentials' => [Object]
},
[Symbol(headers map sorted)]: null
}
}
I think this is similar issue: nodejs/undici#2358
I confirmed this code works fine! (but there seems to be a better way 😇 )
if (!isResponse(response)) {
throw response;
}
function isResponse(v: any): v is Response {
return ["Response", "_Response"].includes(response.constructor.name)
}
from vite-plugins.
Hi @Code-Hex
Thanks for investigating!
I confirmed this code works fine! (but there seems to be a better way 😇 )
I think it's not bad. But I'll find other good ways.
from vite-plugins.
Hi @Code-Hex
Does this issue still happen? I've tried it with the latest @hono/vite-dev-server
, v0.11.0
, it works well. Can you try it again?
from vite-plugins.
@yusukebe Thanks for your confirmation!
I have not been able to confirm this, but if the issue comes up again, I will open it and close it for now!
from vite-plugins.
Related Issues (20)
- [@hono/vite-dev-server] Best way to develop locally? HOT 4
- What's the correct way to import css?
- Error running dev server HOT 2
- Cloudflare pages plugin prevents Vite's library mode from working HOT 6
- bug(dev-server): with multiple configuration methods, env is overwritten HOT 6
- Ignore `.wrangler` directory when watching
- When using @hono/vite-dev-server in Cloudflare Workers development, there is a misjudgment in hono/adapter's env(). HOT 4
- [@hono/vite-dev-server] simple bun usage fails HOT 7
- [@hono/vite-cloudflare-pages] Serve static assets using `_routes.json` HOT 2
- Can't get devServer to work with Qwik & vite-cloudflare-pages
- Hono ViteDevServer takes 2s to serve index html HOT 5
- [@hono/vite-cloudflare-pages] Importing Node.js Modules Throw Runtime Errors HOT 1
- [@hono/vite-cloudflare-pages] Support to serve static files on root directory HOT 3
- [@hono/vite-dev-server] use Vite Runtime API? HOT 7
- Support caches api HOT 2
- Support wasm in cloudflare adapater HOT 1
- Vite dev server crashes if error is introduced in the Hono Server. HOT 2
- Support reading env from `wrangler.toml` in dev server HOT 1
- [@hono/vite-dev-server] add bun websocket support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugins.