tanstack.com icon indicating copy to clipboard operation
tanstack.com copied to clipboard

Fetch call fails when called from dependency code

Open erquhart opened this issue 3 months ago • 0 comments

Convex Better Auth component reactStartHandler function works if inlined in TanStack project code, but not if bundled in dependencies.

Error occurs when attempting to log in. The compiled esm code is not different from the inlined code, so I'm unclear where the issue is. Bringing here in case anything jumps out at anyone. Seems likely related to the fetch call as new Request() isn't explicitly called anywhere.

TypeError: Cannot read properties of undefined (reading 'window')
    at new Request (node:internal/deps/undici/undici:9493:21)
    ... 11 lines matching cause stack trace ...
    at async file:///Users/erquhart/code/gh/tanstack/tanstack.com/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_react@1_piudzk3xt6atgw5qmb3owsqznm/node_modules/@tanstack/start-plugin-core/dist/esm/dev-server-plugin/plugin.js:64:30 {
  cause: TypeError: Cannot read properties of undefined (reading 'window')
      at new Request (node:internal/deps/undici/undici:9493:21)
      at reactStartHandler (/Users/erquhart/code/gh/tanstack/tanstack.com/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]__rkrjdhn4l2ul2h74znm3om3w4y/node_modules/@convex-dev/better-auth/src/react-start/index.ts:124:25)

erquhart avatar Oct 23 '25 19:10 erquhart