Next.js Discord

Discord Forum

Failed to build /(auth)/dashboard/page: /dashboard (attempt 1 of 3) because it took more than 60 sec

Unanswered
Gouty oak gall posted this in #help-forum
Open in Discord
Gouty oak gallOP
I`m trying to figure out what is the problem with this page (and other 2)

this is the content of the dashboard/page.tsx

Version: Next15
Type: App Pages

export const dynamic = "force-dynamic";

function Dashboard() {
  const { t } = useTranslation()
  const user = useAtomValue(currentUser)
  const { data, isLoading, isError, error } = useApiGet<Subscription[]>('/api/subscriptions', ['user-subscriptions'])

  const [canAddItem, setCanAddItem] = useState(false)

  useEffect(() => {
    if (data) {
      const canAddItem = user?.isPremium === true ? true : data.length < appConfigs.FREE_MAX_SUBSCRIPTIONS
      setCanAddItem(canAddItem)
    }
  }, [data])

  if (isError && error) {
    return <HandleStatusErrors status={error.status} message={error.response?.data} />
  }

  const AddItemButton = () => {
    return (
      <Button disabled={!canAddItem}>
        <Link href="/add-item" className='flex items-center gap-2'>
          {canAddItem ? <Plus className='!h-5 !w-5' /> : <Lock />}
          <p>{t('addNewSubscription')}</p>
        </Link>
      </Button>
    )
  }

  return ()

12 Replies

Gouty oak gallOP
same for those

Failed to build /(auth)/dashboard/page: /dashboard (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /(auth)/statistics/page: /statistics (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
Failed to build /(auth)/add-item/page: /add-item (attempt 1 of 3) because it took more than 60 seconds. Retrying again shortly.
useApiGet.tsx
'use client'
import axios, { AxiosError, AxiosResponse } from 'axios'
import { useQuery, UseQueryOptions, UseQueryResult, QueryKey } from '@tanstack/react-query'

export function useApiGet<D>(url: string, queryKey: QueryKey, options?: Partial<UseQueryOptions<D, AxiosError>>): UseQueryResult<D, AxiosError> {
  return useQuery<D, AxiosError>({
    queryKey,
    queryFn: async () => {
      return axios.get<D>(url).then((res: AxiosResponse<D>) => res.data)
    },
    ...options,
    retry: (failureCount) => failureCount < 2
  })
}
Silver Marten
I currently have the same problem :/
Came after upgrading from nextjs 14 to 15
Gouty oak gallOP
i rollback from 15 to 14 and its working
Silver Marten
@Gouty oak gall are you using somewhere something like "await cookies()"?
Gouty oak gallOP
@paul
@Silver Marten i use queryParams in a component but i put export dynamic stuff
rollback was th only solution
nextjs 15 changed a lot and there is no documentation yet
Silver Marten
i can't even explain it why my use of cookies was causing the build timeout but i did the following:
somewhere in my code, i tried (in a server function) to get an cookie by "(await cookies()).get(...)"
after i removed it and wrote "const cookieStore = await cookies()" it worked
so maybe that or something like that could be somewhere in your code too?
Gouty oak gallOP
i read the docs and yea... the Stuck at Generating Statis Pages is caused by some client side parts like getCoockiet, getSearchParams...but i have ongetSearchParams in a /edit/[id]/page.tsx

tho even if i delete that page (for test pourpouses) , the generation static pages stil crashed at 6/17 for some reasone
wierd magic