-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Serving static files via hono on bun kills the prerenderer #28910
Comments
Are you using Unfortunately, |
I am importing |
It seems that you're using Bun as a package manager rather than as a runtime, which are two distinct tools. To learn more about installing Bun as a runtime, check out the official documentation here: Bun Installation Guide. |
Hey @alan-agius4 I did install bun and could also execute the built server with it. |
Can you update please update "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const worker_threads_1 = require("worker_threads");
const schema_1 = require("../../builders/application/schema");
const fetch_patch_1 = require("./fetch-patch");
const launch_server_1 = require("./launch-server");
const load_esm_from_memory_1 = require("./load-esm-from-memory");
/**
* This is passed as workerData when setting up the worker via the `piscina` package.
*/
const { outputMode, hasSsrEntry } = worker_threads_1.workerData;
let serverURL = launch_server_1.DEFAULT_URL;
/** Renders an application based on a provided options. */
async function extractRoutes() {
if (outputMode !== undefined && hasSsrEntry) {
serverURL = await (0, launch_server_1.launchServer)();
}
(0, fetch_patch_1.patchFetchToLoadInMemoryAssets)(serverURL);
const { ɵextractRoutesAndCreateRouteTree: extractRoutesAndCreateRouteTree } = await (0, load_esm_from_memory_1.loadEsmModuleFromMemory)('./main.server.mjs');
const { routeTree, appShellRoute, errors } = await extractRoutesAndCreateRouteTree(serverURL, undefined /** manifest */, true /** invokeGetPrerenderParams */, outputMode === schema_1.OutputMode.Server /** includePrerenderFallbackRoutes */);
return {
errors,
appShellRoute,
serializedRouteTree: routeTree.toObject(),
};
}
exports.default = extractRoutes; |
I'm now getting a new error
I also added both the patched and regular reproduction to https://github.com/heddendorp/ssr-bun-test EDIT: |
Thank you for the information. At this stage, it appears the issue lies with Bun, which is intended to serve as a drop-in replacement for Node.js. However, there seems to be a problem, possibly related to Workers or Atomics, that is causing unexpected behavior. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I wanted to use the new hybrid rendering with hono and bun.
Everything seems to work mostly fine until I try to serve static files from my server. This kills my build process as the route extraction fails.
As long as the static serving is commented out, the build is fine and works with bun and the dev server.
Minimal Reproduction
I have a repro here https://github.com/heddendorp/ssr-bun-test
Cloning, running
bun install
andbun run build
will give you the error.You can get rid of this line
https://github.com/heddendorp/ssr-bun-test/blob/d55241783177d8a940fe713dc4371e80a0eccec6/src/server.ts#L28
to make the build work.
Exception or Error
Your Environment
Anything else relevant?
I'm happy to provide more context to clear this up
The text was updated successfully, but these errors were encountered: