open-next icon indicating copy to clipboard operation
open-next copied to clipboard

Fetch options ignored

Open leanderiversen opened this issue 3 years ago • 4 comments

Hi,

It seems like fetch options like cache: 'force-cache' and next: { revalidate: false } are ignored. When running next build and next start, I can see that no requests are hitting the backend when browsing the site, as expected. However, when deployed, I can see that all the requests are hitting the backend. Leaving the options empty also gives the same result.

Versions Next: 13.5.6 OpenNext: 2.2.4 SST: 2.30.3

Thank you!

leanderiversen avatar Oct 19 '23 11:10 leanderiversen

Did you see this https://open-next.js.org/common_issues/isr#patch-fetch-behaviour-for-isr-only-for-next1351

conico974 avatar Oct 19 '23 13:10 conico974

@conico974 I did not see that, but I have had a look now. When it says to modify the fetch function, what would I need to change? Is the fetch function supposed to be replaced by this code, or just to have it above the fetch function?

leanderiversen avatar Oct 19 '23 13:10 leanderiversen

@conico974 I did not see that, but I have had a look now. When it says to modify the fetch function, what would I need to change? Is the fetch function supposed to be replaced by this code, or just to have it above the fetch function?

You copy the code inside RootLayout inside your own root layout. Then the fix should be applied for every page under app dir

conico974 avatar Oct 19 '23 15:10 conico974

Thank you!

leanderiversen avatar Oct 19 '23 15:10 leanderiversen