Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vercel build error when using HydrationBoundary #7611

Closed
chertik77 opened this issue Jun 22, 2024 · 4 comments
Closed

Vercel build error when using HydrationBoundary #7611

chertik77 opened this issue Jun 22, 2024 · 4 comments

Comments

@chertik77
Copy link

Describe the bug

const DashboardPage = async () => {
  const queryClient = new QueryClient()

  await queryClient.prefetchQuery({
    queryKey: ['profile'],
    queryFn: userService.getProfile
  })

  return (
    <HydrationBoundary state={dehydrate(queryClient)}>
      <Header />
    </HydrationBoundary>
  )
}

export default DashboardPage
'use client'

import { useQuery } from '@tanstack/react-query'

import { userService } from '@/services/user.service'

export const Header = () => {
  const { data } = useQuery({
    queryKey: ['profile'],
    queryFn: userService.getProfile
  })

  return <div>{data?.name}</div>
}

And when i'm deploying on vercel i'm getting this error:

 ⨯ Static worker exited with code: null and signal: SIGTERM
> Build error occurred
Error: Static page generation for /dashboard is still timing out after 3 attempts. See more info here https://nextjs.org/docs/messages/static-page-generation-timeout

Your minimal, reproducible example

.

Steps to reproduce

See the code above

Expected behavior

Successful production build

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS, Arc Browser

Tanstack Query adapter

react-query

TanStack Query version

5.45.1

TypeScript version

5

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 24, 2024

try:

- queryFn: userService.getProfile
+ queryFn: () => userService.getProfile()

in the server component. If that's not helping, I need to see a minimal reproduction please.

@TkDodo TkDodo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@chertik77
Copy link
Author

try:

- queryFn: userService.getProfile
+ queryFn: () => userService.getProfile()

in the server component. If that's not helping, I need to see a minimal reproduction please.

what reproduction? that error appears only when deploying on vercel, on localhost everything is fine

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 25, 2024

what reproduction? that error appears only when deploying on vercel, on localhost everything is fine

then I guess you want to open an issue at vercel 🤷

@chertik77
Copy link
Author

what reproduction? that error appears only when deploying on vercel, on localhost everything is fine

then I guess you want to open an issue at vercel 🤷

I fixed it, it happens because the promise is not resolving

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants