query: (v3) next.js serverless build run into timeout
Describe the bug
When building a next.js application with a serverless target and deploying it on netlify using next-on-netlify results into the page not rendering and running into a timeout. This problem seems to be related to v3, using v2 the app works as intended.
To Reproduce
Demo: https://react-query-v3-timeout.netlify.app/ Code: https://github.com/frigus02/test-react-query-prefetch-ssr
Steps to reproduce the behavior:
yarn installyarn run buildyarn run next-on-netlifyyarn run netlify deploy -s <your_site_id> -d out_publish -f out_functions --prod
Expected behavior
It should render the page correctly without running into a timeout.
Additional context
The timeout issue usually results from a promise or some other long running task not finishing. The serverless functions are deployed on a lambda and only return data if the function returns.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (1 by maintainers)
That could be nice. And easily documented. “If you are in a long running server, do nothing. If you are in a short lived server, do this.”
Thanks for fixing this so quickly. We just tested with version 3.3.0. It works for us with the following setup:
cacheTime: Infinityfor the temporaryQueryClientinsidegetInitialProps/getServerSidePropscacheTime: typeof window === "undefined" ? 0 : 5 * 60 * 1000for theQueryClientused with the<QueryClientProvider/>Is this worth mentioning in the SSR docs?