-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
Output File Tracing not working for ISR page #34246
Comments
I found one reference which might need the manual From the docs:
So just to make sure, could you test out If that works, I still advise being as specific as possible about the inclusions to reduce the output size. Let me know if that works! tested the above pattern on https://globster.xyz/ with the following data:
UPDATE Correction on the above, I re-read our docs, and I believe we can make it slightly easier to understand (I highlighted where it says page configs), but the In export const config = {
unstable_includeFiles: ["assets/data/events/*.yml"]
}; As you can see below, this will include the desired assets in the standalone app: As a caution, I would like to note that any static assets added after the server has started won't be available. |
The page in the fgo-tools repo that is using ISR is the index.jsx page, not events/[slug].jsx. |
Hmm. Looking into https://github.com/Mitsunee/fgo-tools/blob/main/pages/index.jsx I cannot see a |
It's hiding in line 3: It is exporting the function imported from this file: https://github.com/Mitsunee/fgo-tools/blob/main/src/server/HomePage/index.js I did not like having serverside code bunched together with frontend code so I decided to split of SSG/SSR/ISR into its own directory |
The ideal scenario is to keep the bundle size down IMO, but that is of course your design decision. I think the following should be enough then: You will need to give a list of files, not directories, so |
Thinking about it, it probably does not really matter which page you export this from, as the standalone server will serve them all the same. I believe we just merge the different pages configs for this at build-time. It's more about colocation, keeping your config together with the pages that need those files. |
Matching all the files is actually as small as bundle could possibly be without missing data (which is causing the errors I currently have). I will try |
Sounds good, let me know if that helps! I cloned your repo and with the config added, you can see #34246 (comment) that assets are copied over 👍 |
I tried the following in my playground repository which did not seem to work: // index.js
export const config = {
unstable_includeFiles: ["public/**/*.(ico|svg)"]
}; (Deployed here: nextjs-playground-b5cquk25t-mitsunee.vercel.app) For reference the public directory contains the svg icons seen in the ui of that deployment as well as the default favicon from vercel. I have not yet received any logs on logtail through the integration Edit: In the fgo-tools project I was also trying Edit2: It has been over an hour now and I've neither gotten any logs on logtail nor do I see the result of ISR running for the |
Hi @Mitsunee so the above Updating the glob to this should resolve the issue: export const config = {
unstable_includeFiles: ["public/**/*.*(svg|ico)"]
} PR updating documentation for this opened here #34269 |
This ensures we reference [minimatch](https://www.npmjs.com/package/minimatch) since the globs there can have different syntax. ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` Closes: #34246
I've confirmed that adjusting the pattern fixes the playground app, but I am still unsure about why these patterns did not work for my actual app: https://github.com/Mitsunee/fgo-tools/blob/configure-output-file-tracing/pages/index.jsx export const config = {
unstable_includeFiles: [
"assets/data/**/*.yml",
"public/assets/backgrounds/landing/*.png"
]
}; I used pthrasher's minimatch tester to confirm that the patterns should match: The intial deployment (SSG) ran without problems and I can also run everything just fine locally, so I'm assuming ISR is still throwing due to the files not being there |
@Mitsunee it looks like you're only including |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Run
next info
(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.9
What version of Node.js are you using?
14.18.2
What browser are you using?
chromium-based
What operating system are you using?
Kubuntu
How are you deploying your application?
vercel
Describe the Bug
I am currently (with the help of Vercel Support, who also advised me to open an Issue here) debugging why ISR is not working for my project and we've narrowed down the issue to Output File Tracing not catching any of the filesystem calls in my
getStaticProps
function as they are wrapped in convenience functions specifically written for next.js (in the@foxkit/node-util
module that I wrote for this purpose). Even after specifically includingunstable_includeFiles: ["assets/data", "public/assets/backgrounds"]
in thenext.config.mjs
file none of the calls are recognized and the directory available during ISR revalidation remains basically empty other than the.next
directory (which btw does not contain a directory calledcache
anymore).I have also made a little test app that scans the working directory which somehow has the same issue despite not using the
@foxkit/node-util
package: https://nextjs-playground-mitsunee.vercel.app/This app imports
fs from "fs/promises"
and uses thereaddir
andstat
methods, neither of which appear to get recognized by Output File Tracing.Expected Behavior
for fgo-tools: The entire directories
assets/data
andpublic/assets/backgrounds
are available in the working directory of all serverless functions as per configuration file.for the test app: The entire directory excluding node_modules was touched using fs.promises.stat and should thus be available.
To Reproduce
I am honestly not entirely sure. I have a PR on my fgo-tools repo with the issue as well as the test app's repo
The text was updated successfully, but these errors were encountered: