-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
The simplest hono app fails to start #17568
Comments
import { Hono } from 'hono'
const hono = new Hono()
/**
* Default route
*/
.get('/', c => c.json({ message: 'Hello World' }))
export default {
port: 3000,
fetch: hono.fetch,
} use this as workaround |
I came to report the same thing; with the latest update it breaks like crazy! This simple code import { Hono } from 'hono'
type Variables = {
message: string
};
const app = new Hono<{ Variables: Variables }>()
app.use(async (c, next) => {
c.set('message', 'Hono is cool!');
await next();
});
app.get('/', (c) => {
const message = c.get('message');
return c.text(`The message is "${message}"`)
});
export default app throws the following errors: 7 | if (typeof entryNamespace?.default?.fetch === 'function') {
8 | const server = Bun.serve(entryNamespace.default);
9 | console.debug(`Started ${server.development ? 'development ' : ''}server: ${server.protocol}://${server.hostname}:${server.port}`);
10 | }
11 | }, reportError);
12 | const server = Bun.serve(entryNamespace.default);
^
TypeError: Invalid route "0". Path must start with '/'
code: "ERR_INVALID_ARG_TYPE"
at bun:main:12:28
Bun v1.2.3 (Linux x64) |
Best I can tell, this bug was introduced in #17357. |
Best way to avoid export default like this |
Same here, I don't wanna migrate all my projects to export either. 😩 |
Seems like the latest version isn't released yet, I worked around this by just downgrading:
|
What version of Bun is running?
1.2.3+8c4d3ff80
What platform is your computer?
Darwin 24.3.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
It runs
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: