#Hono + nginx not serving correctly on 1.3

1 messages · Page 1 of 1 (latest)

solemn vapor
#

I dont know if this might be an issue on bun 1.3 or something I did wrong. My setup is:

  • nginx on proxy pass to hono backend
  • hono serving as backend with also the static files built with a tanstack router app, (vite+bun)
  • drizzle with postgres

On 1.2.23 worked fine and everything was, so it should be something that changed. Now the backend is logging the requests but the response is like the screenshot. Am I doing something wrong? If I downgrade to 1.2.23 without changes it works. What can I do to reproduce without sharing my whole code? Seems like on dev is working but on prod is not. So I thought maybe is something with nginx

solemn vapor
#

seems like bun is adding Content-Length: 0 to the last line of every asset?

solemn vapor
#

having the same content-length 0 issue on 1.3.1

#

This might add some context, (not including my other endpoints, im guessing they dont interfer), serving the built app has this code:


const staticRoot = new URL("../frontend/dist", import.meta.url).pathname;
const app = new Hono<{
  Variables: {
    user: typeof auth.$Infer.Session.user | null;
    session: typeof auth.$Infer.Session.session | null;
  };
}>();

app.use(
  "/*",
  serveStatic({
    root: staticRoot,
    rewriteRequestPath: (path) => {
      const pathname = path.split("?")[0];
      if (pathname === "/" || !pathname.split("/").pop()?.includes(".")) {
        return "/index.html";
      }
      return pathname;
    },
  }),
);

const server = serve({
  fetch: app.fetch,
  port: Number(process.env.PORT ?? 3001),
});