blitz icon indicating copy to clipboard operation
blitz copied to clipboard

Support Bun runtime

Open cfragkos opened this issue 1 year ago • 6 comments

What do you want and why?

Now that Bun is stable, and next supports it maybe it is time to implement support for Blitz.

cfragkos avatar Jan 16 '24 13:01 cfragkos

My understanding is that all Node stuff should just work in Bun, right? Nothing special needed for us?

flybayer avatar Jan 16 '24 15:01 flybayer

For the package manager yes, for the runtime i think there are need some changes. I did try to run it and it did not work, there was some runtime error in @blitz/auth

cfragkos avatar Jan 16 '24 16:01 cfragkos

@cfragkos I just took a look, I see that blitz.js + next pages is working without any noticeable issues on bunjs runtime. Do you have any particular issue / errors you faced that affected blitz alone?

AFAIK The app directory is not working with bun yet, so there is nothing we can do to support it.

siddhsuresh avatar Jan 23 '24 13:01 siddhsuresh

Did you run it with bun as a package manager or as runtime as well (bun --bun run dev)?

cfragkos avatar Jan 23 '24 13:01 cfragkos

both, and as a run time through bun --bun blitz dev. It would be nice to have some reproduction repos or error logs to debug individual issues. (only pages router)

siddhsuresh avatar Jan 23 '24 15:01 siddhsuresh

So this is a very weird error display. The way it is shown I am not sure if it is related to sentry or blitz but here you go

BTW Page does render normally, but I did not go in depth of checking that everything works fine.

 ○ Compiling / ...
 ✓ Compiled / in 18.5s (4679 modules)
294 |     }
295 |   }
296 | };
297 | const authorizeRole = (role, currentRole) => {
298 |   if (role && currentRole) {
299 |     if (Array.isArray(role)) {
                                  ^
error: Rendering Suspense fallback...
      at /home/kfragkos/HealthierDoctor/node_modules/@blitzjs/auth/dist/chunks/index.cjs:299:29

 GET / 200 in 20310ms
Failed to proxy https://o479330.ingest.sentry.io/api/4506309548572672/envelope/?o=479330&p=4506309548572672&hsts=0 ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
 path: "http://o479330.ingest.sentry.io:443/api/4506309548572672/envelope/?o=479330&p=4506309548572672&hsts=0"

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
 path: "http://o479330.ingest.sentry.io:443/api/4506309548572672/envelope/?o=479330&p=4506309548572672&hsts=0"

My bun blitz -v

Blitz version: 2.0.3 (local)
Linux 5.15 | linux-x64 | Node: v20.11.0


 Package manager: pnpm

  System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 10.76 GB / 15.19 GB
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    Yarn: Not Found
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.3 => 2.0.3 
    @blitzjs/next: 2.0.3 => 2.0.3 
    @blitzjs/rpc: 2.0.3 => 2.0.3 
    @prisma/client: ^5.8.1 => 5.8.1 
    blitz: 2.0.3 => 2.0.3 
    next: ^14.1.0 => 14.1.0 
    prisma: ^5.8.1 => 5.8.1 
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    typescript: 5.3.3 => 5.3.3 

cfragkos avatar Jan 23 '24 15:01 cfragkos