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
Support config.includeFiles for @now/next #3083
Comments
The If you have it in Is your const { readFileSync } = require('fs');
const { join } = require('path');
const content = readFileSync(join(__dirname, '..', '..', 'email-templates', 'login', 'html.pug'), 'utf8'); |
Thanks @styfle ! The file that does the reading is at None of the following paths worked (and
Do you think it might be that it's not a NOTE: The fifth version works without problems with |
Thanks for the detailed feedback! There is a fix in this PR vercel/next.js#8334 |
@styfle Thanks for mentioning that! It seems that'll solve the In any case, is there an easy way for me to try that (can I just refer the branch from the PR as the next dependency version)? |
The PR fixes more than the |
Thanks for the clarification! So while technically the problem will be solved, the builder still won't support |
I just realized
In my case it was even simpler. The output was static so I just wrote it directly into Hope this helps! |
This bug has been fixed in the latest Next.js builder version, so this feature request should be obsolete. |
That's what this feature request is about since October 2019. I hope that makes sense, and if that's been solved, you can go ahead and close this! |
The current plan is still to not support Any cases where Next.js does not automatically pick up on file usage should be considered a bug and fixed accordingly. Per vercel/next.js#8251, all file reading must currently be done relative to the CWD (this is a Next.js itself limitation): path.resolve(process.cwd(), 'myfile.txt') |
Thanks! If I run into these issues again in the future I'll add more info. |
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
It's impossible to read files in serverless functions from outside the src folder. I've tried a lot of things, including various import workarounds and converting the api route into a separate lambda. This is the most elegant solution for now. See: - vercel/next.js#8251 - vercel/next.js#8251 (comment) - vercel/vercel#3083 (comment)
There's a message/thread in Spectrum about this.
Basically I can't
fs.readFileSync()
inside anpages/api/whatever.ts
because the files aren't copied.I've done some investigation in the code for the builders, and I don't see any parity for the functionality that exists in @now/node. I imagine something should be added around here for that, and am happy to try a PR if you don't think this is too crazy.
Here's the info I posted in Spectrum:
I'm having this same issue with
@now/next
, so I have this in anow.json
file:Where a directory with this structure exists in the root of the app/directory:
And I can't read the files at all (I've tried all kinds of combinations to just find the files, and here's the latest):
The error I get is:
And while the path looks weird (I'd expect
__dirname
to be/var/task
, not/
), it also doesn't work if I try to read/var/task/email-templates/login/html.pug
.Thanks!
The text was updated successfully, but these errors were encountered: