bun icon indicating copy to clipboard operation
bun copied to clipboard

Support Remix

Open CyriacBr opened this issue 2 years ago β€’ 16 comments

What version of Bun is running?

0.5.8

What platform is your computer?

Darwin 22.1.0 arm64 arm

What steps can reproduce the bug?

  1. Create a new Remix project
  2. In the package.jsonfile, replace the build script with bunx --bun remix build

What is the expected behavior?

Should work just like with Node

What do you see instead?

Cannot find package "inspector" from "/.../app/node_modules/@remix-run/dev/dist/cli/run.js"

Additional information

No response

CyriacBr avatar Apr 01 '23 20:04 CyriacBr

after #2534, now it's failing due to missing writev

image

Jarred-Sumner avatar Apr 02 '23 01:04 Jarred-Sumner

We've added writev in Bun v0.6.11

Jarred-Sumner avatar Jun 28 '23 21:06 Jarred-Sumner

New blocker: Intl.ListFormat on macOS. The libicu headers bundled with WebKit on macOS are very out of date. We need to update them.

image

Jarred-Sumner avatar Jun 28 '23 21:06 Jarred-Sumner

Great to see things progressing! πŸŽ‰

CyriacBr avatar Jun 28 '23 21:06 CyriacBr

The Intl.DateFormat now breaks remix dev also

$ bun --bun run dev
$ remix dev
515 |   return path__default["default"].resolve(rootDirectory, serverBuildPath);
516 | };
517 | 
518 | // adds types for `Intl.ListFormat` to the global namespace
519 | // we could also update our `tsconfig.json` to include `lib: ["es2021"]`
520 | let conjunctionListFormat = new Intl.ListFormat("en", {
                                ^
TypeError: undefined is not a constructor (evaluating 'new Intl.ListFormat("en", {
    style: "long",
    type: "conjunction"
  })')
      at /Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/config.js:520:28
      at globalThis (/Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/config.js:589:21)
      at require (:1:20)
      at /Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/compiler/utils/postcss.js:20:4
      at globalThis (/Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/compiler/utils/postcss.js:242:43)
      at require (:1:20)
      at /Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/compiler/plugins/cssImports.js:19:4
      at globalThis (/Users/colinmcd94/Documents/bun/fun/examples/my-remix-app/node_modules/@remix-run/dev/dist/compiler/plugins/cssImports.js:215:24)
error: script "dev" exited with code 1 (SIGHUP)

colinhacks avatar Sep 04 '23 23:09 colinhacks

For those following along: https://twitter.com/jarredsumner/status/1687977091089027072

WebKit bumped their minimum target to macOS 12. This later version of libicu fixes a bug blocking Remix’s CLI from working in development on macOS (adds a missing Intl class)

kevlened avatar Sep 06 '23 19:09 kevlened

Getting this for dev:

➜ bun run dev  
$ bunx --bun remix dev

 πŸ’Ώ  remix dev

 info  building...
 info  built (186ms)
Remix App Server started at http://localhost:3000 (http://192.168.0.115:3000)
Could not reach Remix dev server at http://localhost:3001/ping
21 | 	 * @param {string} type 
22 | 	 */
23 | 	constructor(message, type) {
24 | 		super(message);
25 | 		// Hide custom error implementation details from end-users
26 | 		Error.captureStackTrace(this, this.constructor);
     ^
error: request to http://localhost:3001/ping failed, reason: Can only call URLSearchParams.toJSON on instances of URLSearchParams
 code: "undefined"

      at new FetchBaseError (/Users/admin/repos/remix-test/my-remix-app/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:26:2)
      at new FetchError (/Users/admin/repos/remix-test/my-remix-app/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:64:2)
      at /Users/admin/repos/remix-test/my-remix-app/node_modules/@remix-run/web-fetch/dist/lib.node.cjs:1779:10

birkskyum avatar Sep 18 '23 09:09 birkskyum

Update with latest canary:

➜ bun --bun remix dev

 πŸ’Ώ  remix dev

 warn  The `serverNodeBuiltinsPolyfill` config default option will be changing in v2
┃ Server polyfills will no longer be provided by default for non-Node.js platforms.
┃ You can prepare for this change by specifying server polyfills, or opting out entirely.
┃ -> https://remix.run/docs/en/v1.19.0/pages/v2#servernodebuiltinspolyfill
β”—
 warn  The `devServerBroadcastDelay` config option will be removed in v2
┃ Enable `v2_dev` to eliminate the race conditions that necessitated this option.
┃ -> https://remix.run/docs/en/v1.19.3/pages/v2#devserverbroadcastdelay
β”—
 info  building...
 info  built (198ms)

605 |   }
606 |   get stdio() {
607 |     return this.#stdioObject ??= this.#createStdioObject();
608 |   }
609 | 
610 |   spawn(options) {
                 ^
TypeError: Command failed with ERR_INVALID_ARG_TYPE: remix-serve functions/[[path]].js
Executable not found in $PATH: "remix-serve"
 code: "ERR_INVALID_ARG_TYPE"

      at spawn (node:child_process:610:14)
      at node:child_process:2:40
      at execa (/Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/execa/index.js:83:12)
      at /Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/execa/index.js:230:8
      at startAppServer (/Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:135:23)
      at /Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:234:28
      at onBuildFinish (/Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:217:31)
      at /Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/compiler/watch.js:75:64
      at processTicksAndRejections (:55:76)
545 |     } else
546 |       this.emit("exit", this.exitCode, this.signalCode);
547 |     process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = ["destroyed", "destroyed", "destroyed"];
548 |   }
549 | 
550 |   #getBunSpawnIo(i, encoding) {
                                   ^
TypeError: undefined is not an object
      at #getBunSpawnIo (node:child_process:550:32)
      at node:child_process:598:22
      at startAppServer (/Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:161:8)
      at /Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:234:28
      at onBuildFinish (/Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/devServer_unstable/index.js:217:31)
      at /Users/admin/repos/bun-kitchensink/remix-test/test/node_modules/@remix-run/dev/dist/compiler/watch.js:75:64
      at processTicksAndRejections (:55:76)

birkskyum avatar Oct 13 '23 17:10 birkskyum

Note, Remix is migrating to Vite:

  • https://remix.run/docs/en/dev/future/vite

birkskyum avatar Oct 13 '23 17:10 birkskyum

With latest bun (1.0.23+83f2432da) i get this:

1.0.23 
➜ bun --bun run dev  
$ remix dev --manual

 πŸ’Ώ  remix dev

 info  building...
 info  built (234ms)
1 | (function (entry, fetcher)
    ^
SyntaxError: Export named 'renderToPipeableStream' not found in module '/Users/admin/repos/my-remix-app/node_modules/react-dom/server.browser.js'.

related to

  • https://github.com/oven-sh/bun/issues/5664#issuecomment-1741385324

birkskyum avatar Jan 19 '24 23:01 birkskyum

bun 1.1.0 remix 2.8.1 vite 5.1.6

bun --bun run dev
remix vite:dev --port 3000
  ➜  Local:   http://localhost:3000/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
Expected a Response object
4524 |       errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
4525 |     } else if (method) {
4526 |       errorMessage = "Invalid request method \"" + method.toUpperCase() + "\"";
4527 |     }
4528 |   }
4529 |   return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);
                                                                 ^
error: No route matches URL "/manifest.json"
      at getInternalRouterError (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:4529:59)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:3359:19
      at query (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:3326:24)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:184:21
      at handleDocumentRequestRR (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:181:40)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:108:24

No routes matched location "/manifest.json" 
ErrorResponseImpl {
  status: 404,
  statusText: "Not Found",
  internal: true,
  data: "Error: No route matches URL \"/manifest.json\"",
  error: 4524 |       errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
4525 |     } else if (method) {
4526 |       errorMessage = "Invalid request method \"" + method.toUpperCase() + "\"";
4527 |     }
4528 |   }
4529 |   return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);
                                                                 ^
error: No route matches URL "/manifest.json"
      at getInternalRouterError (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:4529:59)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:3359:19
      at query (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/dist/router.cjs.js:3326:24)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:184:21
      at handleDocumentRequestRR (/home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:181:40)
      at /home/lucdev/dev/miri/Web/node_modules/@remix-run/server-runtime/dist/server.js:108:24
,
}
Expected a Response object

image

lucrnz avatar Apr 03 '24 15:04 lucrnz

1.1.9-canary.1+4e714ae9d

same error with manifest.json, both on dev server an running the build.

birkskyum avatar May 18 '24 00:05 birkskyum

Hi, any updates on running remix with bun?

IgnisDa avatar Jul 15 '24 05:07 IgnisDa

@IgnisDa

🟒 Creation / Dev server

the starter seems to be working alright for creation, dev:

➜ bunx create-remix@latest
➜ bun --bun run dev
$ remix vite:dev
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
Screenshot 2024-07-15 at 20 44 08

🟒 Building also works, the first time it's run:

➜ bun --bun run build
$ remix vite:build
vite v5.3.3 building for production...
βœ“ 85 modules transformed.
build/client/.vite/manifest.json                1.12 kB β”‚ gzip:  0.32 kB
build/client/assets/root-BFUH26ow.css           5.36 kB β”‚ gzip:  1.63 kB
build/client/assets/_index-B6hwyHK-.js          0.94 kB β”‚ gzip:  0.41 kB
build/client/assets/root-Ca5PpFob.js            1.44 kB β”‚ gzip:  0.84 kB
build/client/assets/entry.client-CqMLZIdi.js    4.11 kB β”‚ gzip:  1.55 kB
build/client/assets/jsx-runtime-56DGgGmo.js     8.11 kB β”‚ gzip:  3.06 kB
build/client/assets/components-CPckMTFJ.js    243.44 kB β”‚ gzip: 78.46 kB
βœ“ built in 682ms
vite v5.3.3 building SSR bundle for production...
βœ“ 6 modules transformed.
build/server/.vite/manifest.json               0.22 kB
build/server/assets/server-build-BFUH26ow.css  5.36 kB
build/server/index.js                          7.21 kB
βœ“ built in 30ms

Note: Remember to remove the build folder if repeating the command, or you'll see this error (don't know if it's the same with Node):

➜ bun --bun run build
error: Module not found "/Users/admin/repos/bun-kitchensink/new-remix/build"

Bun v1.1.20-canary.1+20235a0d2 (macOS arm64)

🟑 Preview (remix-serve) loads the bun default screen instead of the app:

➜ bun --bun run start
$ remix-serve ./build/server/index.js
[remix-serve] http://localhost:3000 (http://192.168.0.57:3000)
Screenshot 2024-07-15 at 20 43 53

... and when accessing the pages, these errors are printed in the console:

ErrorResponseImpl {
  status: 404,
  statusText: "Not Found",
  internal: true,
  data: "Error: No route matches URL \"/manifest.json\"",
  error: 5092 |       errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
5093 |     } else if (method) {
5094 |       errorMessage = "Invalid request method \"" + method.toUpperCase() + "\"";
5095 |     }
5096 |   }
5097 |   return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);
                                                                 ^
error: No route matches URL "/manifest.json"
      at getInternalRouterError (/Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/router/dist/router.cjs.js:5097:59)
      at /Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/router/dist/router.cjs.js:3768:19
      at query (/Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/router/dist/router.cjs.js:3733:24)
      at /Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/server-runtime/dist/server.js:268:35
      at handleDocumentRequest (/Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/server-runtime/dist/server.js:264:38)
      at /Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/server-runtime/dist/server.js:160:24
      at requestHandler (/Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/server-runtime/dist/server.js:64:40)
      at /Users/admin/repos/bun-kitchensink/new-remix/node_modules/@remix-run/express/dist/server.js:41:28
,
}
error: Expected a Response object, but received 'Response {
  [Symbol(Body internals)]: {
    body: ReadableStream {
      locked: [Getter],
      cancel: [Function: cancel],
      getReader: [Function: getReader],
      pipeTo: [Function: pipeTo],
      pipeThrough: [Function: pipeThrough],
      tee: [Function: tee],
      values: [Function: values],
      [Symbol(Symbol.asyncIterator)]: [Function: lazyAsyncIterator],
    },
    type: null,
    size: null,
    boundary: null,
    disturbed: false,
    error: null,
  },
  size: 0,
  [Symbol(Response internals)]: {
    url: undefined,
    status: 404,
    statusText: "Not Found",
    headers: {},
    counter: 0,
    highWaterMark: undefined,
  },
  type: [Getter],
  url: [Getter],
  status: [Getter],
  ok: [Getter],
  redirected: [Getter],
  statusText: [Getter],
  headers: [Getter],
  highWaterMark: [Getter],
  clone: [Function: clone],
  body: [Getter],
  bodyUsed: [Getter],
  arrayBuffer: [AsyncFunction: arrayBuffer],
  blob: [AsyncFunction: blob],
  json: [AsyncFunction: json],
  text: [AsyncFunction: text],
  formData: [AsyncFunction: formData],
}'

birkskyum avatar Jul 15 '24 18:07 birkskyum

That’s just your browser requesting the manifest that doesn’t exist.

Bun works with remix, I’ve been using it in production for months with bun serve as the root handler.

zackify avatar Jul 15 '24 18:07 zackify

@zackify , okay, it's a bit odd to me that a mandatory manifest.json file is missing from the starter, but if it's trivial to add and remove the error then I guess it's alright.

birkskyum avatar Jul 15 '24 19:07 birkskyum

@zackify Are you aware of any way to get the default remix template working with bun both in dev and production?

IgnisDa avatar Jul 16 '24 17:07 IgnisDa

@zackify There are two errors in that comment. One is related to a manifest file which can be ignored, but the other one is related to the remix response object (I believe)

error: Expected a Response object, but received 'Response {
  [Symbol(Body internals)]: {
    body: ReadableStream {
      locked: [Getter],
      cancel: [Function: cancel],
      getReader: [Function: getReader],
      pipeTo: [Function: pipeTo],
      pipeThrough: [Function: pipeThrough],
      tee: [Function: tee],
      values: [Function: values],
      [Symbol(Symbol.asyncIterator)]: [Function: lazyAsyncIterator],
    },
    type: null,
    size: null,
    boundary: null,
    disturbed: false,
    error: null,
  },
  size: 0,
  [Symbol(Response internals)]: {
    url: undefined,
    status: 404,
    statusText: "Not Found",
    headers: {},
    counter: 0,
    highWaterMark: undefined,
  },
  type: [Getter],
  url: [Getter],
  status: [Getter],
  ok: [Getter],
  redirected: [Getter],
  statusText: [Getter],
  headers: [Getter],
  highWaterMark: [Getter],
  clone: [Function: clone],
  body: [Getter],
  bodyUsed: [Getter],
  arrayBuffer: [AsyncFunction: arrayBuffer],
  blob: [AsyncFunction: blob],
  json: [AsyncFunction: json],
  text: [AsyncFunction: text],
  formData: [AsyncFunction: formData],
}'

I'm getting that error when trying to navigate to pages when running my remix app with Bun (but the same issue does not happen when using node).

It definitely is isolated to Bun and instead of serving my remix page it serves the bun default page.

monsonjeremy avatar Jul 16 '24 17:07 monsonjeremy

We've fixed the main bug blocking Remix from working correctly in Bun and added an integration test to prevent this from regressing in the future. It will be part of the Bun v1.1.21 release, which is soon

cc @jacob-ebey

Jarred-Sumner avatar Jul 27 '24 06:07 Jarred-Sumner