Skip to content

Start: Error in renderToPipeableStream: TypeError: Cannot read properties of undefined (reading 'streamValue') #4493

Open
@alexwork1611

Description

@alexwork1611

Which project does this relate to?

Start

Describe the bug

Ever since I updated from @tanstack/[email protected], I am getting an error coming from @tanstack/react-router-with-query (so I am stuck on 1.121.10 until I fix it).

Here is the error:

Error in renderToPipeableStream: TypeError: Cannot read properties of undefined (reading 'streamValue')
    at Object._experimental_afterQuery (...\node_modules\.pnpm\@tanstack+react-router-with_436e81a5a885a270aeb9c308c96ba802\node_modules\@tanstack\react-router-with-query\src\index.tsx:95:29)
    at useBaseQuery (...\node_modules\.pnpm\@[email protected][email protected]\node_modules\@tanstack\react-query\src\useBaseQuery.ts:144:49)
    at useSuspenseQuery (...\node_modules\.pnpm\@[email protected][email protected]\node_modules\@tanstack\react-query\src\useSuspenseQuery.ts:23:10)
    at useSessionSuspenseQuery (...\src\hooks\api\use-session-suspense-query.ts:6:31)
    at useIsSignedInSuspense (...\src\hooks\api\use-is-signed-in-suspense.ts:5:35)
    at useUserSettings (...\src\hooks\api\use-user-settings.ts:14:25)
    at useCustomTheme (...\src\hooks\use-custom-theme.ts:7:26)
    at useBreakpointUp (...\src\hooks\use-breakpoint-up.ts:9:3)
    at RootFragment (...\src\components\app\root-fragment.tsx:12:19)
    at react-stack-bottom-frame (...\node_modules\.pnpm\[email protected][email protected]\node_modules\react-dom\cjs\react-dom-server.node.development.js:9176:18) { componentStack: [Getter] }

Here is the line of code that the error is pointing me to:

router.serverSsr!.streamValue(

Here is the function in my app that is probably causing the problem:

import { OPERATION_KEYS } from '@/constants/operation-keys'
import { authClient } from '@/lib/auth-client'
import { useSuspenseQuery } from '@tanstack/react-query'

export function useSessionSuspenseQuery() {
	const sessionSuspenseQuery = useSuspenseQuery({
		queryKey: OPERATION_KEYS.auth.session,
		queryFn: async () => await authClient.getSession(),
	})

	return { sessionSuspenseQuery }
}

The authClient variable is the better-auth (auth library) client for my application. I think the server is trying to SSR this function and it's resulting in the error. But honestly, I'm not really sure what to make of this. Any ideas are welcome!

Your Example Website or App

Could not replicate

Steps to Reproduce the Bug or Issue

Not sure how to reproduce. If you could instruct me how to make a reproduction for this, I would appreciate it (based on the error stack and app code provided above).

Expected behavior

No error.

Screenshots or Videos

No response

Platform

  • OS: Windows 11
  • Browser: Chrome
  • Version: 137 (latest)

Additional context

No response

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