Skip to content
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

when NODE_ENV='production' getting error on request send #5528

Closed
nayabshah opened this issue Mar 10, 2024 · 2 comments
Closed

when NODE_ENV='production' getting error on request send #5528

nayabshah opened this issue Mar 10, 2024 · 2 comments

Comments

@nayabshah
Copy link

when i am setting NODE_ENV to 'production' and sending any request getting this error:

if (done) return done(err);
^

TypeError: done is not a function
at /home/ubuntu/taskManager/node_modules/express/lib/response.js:450:22
at SendStream.ondirectory (/home/ubuntu/taskManager/node_modules/express/lib/response.js:1064:5)
at SendStream.emit (node:events:519:28)
at SendStream.redirect (/home/ubuntu/taskManager/node_modules/send/index.js:475:10)
at onstat (/home/ubuntu/taskManager/node_modules/send/index.js:723:41)
at FSReqCallback.oncomplete (node:fs:205:5)

i tried updating express version but still get the same error

@nayabshah nayabshah added the bug label Mar 10, 2024
@jonchurch
Copy link
Member

jonchurch commented Mar 11, 2024

Thanks for reaching out! Just a heads up, we usually use GitHub issues for bug reports and feature requests. While we'd love to help everyone, we can't offer in-depth support for individual apps here. For questions like yours, Stack Overflow, reddit, or similar forums might be your best bet.

that said, it looks like somehow the third argument to res.sendFile is not a function.

It could be a middleware you are using which behaves differently depending on NODE_ENV, but if you have application code checking node env then I'd start there.

Without seeing a reproducible example it's not possible to tell if this is a bug in express or your application code. What's happening is your sendFile is encountering an error (seems to be attempting to send a directory) and then when it attempts to invoke the callback passed to sendFile with the error it received, it sees that the callback is truthy, attempts to invoke it, but fails bc the callback is not a function.

@jonchurch
Copy link
Member

jonchurch commented Mar 11, 2024

If you provide a minimum reproducible example we can reopen to investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants