You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var express = require('express');
var router = express.Router();
router.get('/', function (req, res) {
console.log('Sending file');
var options = {
root: __dirname + '/public/'
};
var fileName = 'package.zip';
res.sendFile(fileName, options, function (err) {
if (err) {
console.log(err);
next(err);
} else {
console.log('Sent:', fileName);
}
});
})
module.exports = router
When I call this API, it fails at the res.sendFile(fileName,....) step with the following error. Note: It doesn't even reach the if(err) step.
Sending file
Worker ce5e00ff-a507-4910-92cc-8ce08323c082 uncaught exception: TypeError: Cannot read property 'length' of null
Worker ce5e00ff-a507-4910-92cc-8ce08323c082 exited with code 1
at ServerResponse._send (_http_outgoing.js:232:33)
at write_ (_http_outgoing.js:667:15)
at ServerResponse.write (_http_outgoing.js:617:10)
at ReadStream.ondata (_stream_readable.js:639:20)
at emitOne (events.js:116:13)
at ReadStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ReadStream.Readable.push (_stream_readable.js:208:10)
at fs.read (fs.js:2051:12)
Debugger attached.
Waiting for the debugger to disconnect...
Language Worker Process exited.
node exited with code 1
Worker ce5e00ff-a507-4910-92cc-8ce08323c082 uncaught exception: TypeError: Cannot read property 'length' of null.
The problem goes away, if I change the index.js to just use express.js (without any other changes)
Updated index.js which is working:
I am trying to use azure-function-express in my code.
Here is my piece of code in
index.js
:Here is my
myrouter.js
:When I call this API, it fails at the
res.sendFile(fileName,....)
step with the following error.Note: It doesn't even reach the
if(err)
step.The problem goes away, if I change the
index.js
to just use express.js (without any other changes)Updated
index.js
which is working:Can you please look into the issue
The text was updated successfully, but these errors were encountered: