Skip to content

Fetch call fails when called from dependency code #518

@erquhart

Description

@erquhart

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/@tanstack+start-plugin-core@1.132.51_@tanstack+react-router@1.132.47_react-dom@19.0.0_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/@convex-dev+better-auth@0.8.9_@standard-schema+spec@1.0.0_better-auth@1.3.8_react-dom@19.0.0__rkrjdhn4l2ul2h74znm3om3w4y/node_modules/@convex-dev/better-auth/src/react-start/index.ts:124:25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions