bun icon indicating copy to clipboard operation
bun copied to clipboard

Bug: TypeErrorCLIENT when accessing nextjs website

Open adrianmg opened this issue 3 years ago • 2 comments
trafficstars

👋 Hi! First of all, congratulations on shipping this publicly. It looks great.

I'm listing a couple of bugs I've encountered. Not sure if they are related or if this is going to provide enough context, let me know.

📦 package.json
"dependencies": {
  "@prisma/client": "^4.0.0",
  "@radix-ui/react-dialog": "^0.1.8-rc.50",
  "@radix-ui/react-popover": "^0.1.7-rc.43",
  "@radix-ui/react-radio-group": "^0.1.6-rc.46",
  "bun-framework-next": "^12.1.5",
  "contentlayer": "^0.2.6",
  "next": "^12.2.1",
  "next-contentlayer": "^0.2.6",
  "npm": "^8.13.2",
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "swr": "^1.3.0"
},
"devDependencies": {
  "@types/react": "^18.0.15",
  "autoprefixer": "^10.4.7",
  "eslint": "^8.19.0",
  "eslint-config-next": "^12.2.1",
  "eslint-plugin-tsdoc": "^0.2.16",
  "postcss": "^8.4.13",
  "prisma": "^4.0.0",
  "stylelint-config-recommended": "^8.0.0",
  "tailwindcss": "^3.1.4",
  "typescript": "^4.7.4"
}

Error loading the page

Right after setting things up (following the how to upgrade from an existing project), I encounter this error when accessing https://localhost:3000:

image
📄 Error markdown

$$a889e870.hasBasePath is not a function In bun-framework-next/client.development.tsx – node_modules.bun:7381:20

      serverRuntimeConfig: {},
      publicRuntimeConfig: runtimeConfig || {}
    });
    let asPath = $$3e9be2b6.getURL();
    if ($$a889e870.hasBasePath(asPath))
    /*             ^ happend here     */
      asPath = $$a889e870.delBasePath(asPath);
    const pageLoader = new PageLoader(buildId, prefix, pages);
    __export(module.exports, { pageLoader: () => (pageLoader) });

Stack trace:


  `bun-framework-next/client.development.tsx` node_modules.bun:7381:20
  `h`                                         node_modules.bun:7:6571
  λ()                                         node_modules/bun-framework-next/fallback.development.tsx:21:18

Info:

bun v0.1.2 framework: [email protected] macOS 12.5.0 (Apple Silicon) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36 Pathname: /

adrianmg avatar Jul 09 '22 05:07 adrianmg

I have the same issue, only when porting an existing project and not when testing the bun's create next app. The following repo should have it reproducible: https://github.com/TiKevin83/gsr-automation-site It only shows up during dev, site is fine during bun export (which runs the script next build && next export). Not sure about next start, I have a separate issue there getting a 404 if I have that as a script start and run bun start

TiKevin83 avatar Jul 25 '22 01:07 TiKevin83

This can be worked around by downgrading next to 12.1, this issue occurs on 12.2+. Might be worth specifying to limit next to 12.1 in the README in the meantime.

TiKevin83 avatar Jul 30 '22 02:07 TiKevin83

bun dev was changed in Bun v1.0, it will now run the "dev" script in your package.json. Because of that, this issue is no longer applicable.

Electroid avatar Oct 25 '23 18:10 Electroid