2.0 seems to have broken static file serving on azure.
See original GitHub issueI have the following code in my function-app:
app.use("/", express.static("www"));
This results in the following runtime exception:
2018-09-07T22:14:29.829 [Info] Function started (Id=65d1f81f-f1ed-4d9f-844e-7fdcae8cf5c6)
2018-09-07T22:14:31.782 [Error] A ScriptHost error has occurred
2018-09-07T22:14:31.782 [Error] System.InvalidOperationException : TypeError: Cannot read property 'length' of null
at ServerResponse.OutgoingMessage._send (_http_outgoing.js:137:38)
at ServerResponse.OutgoingMessage.write (_http_outgoing.js:491:16)
at ReadStream.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at ReadStream.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at ReadStream.Readable.push (_stream_readable.js:134:10)
at onread (fs.js:2018:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:682:17)
Note the calls into the new methods inherited by OutgoingMessage.
I’m not sure what’s up here but i think this starting breaking when the change to derive from NativeOutgoingMessage. Do you know what’s up @yvele ? Do you have a recommendation on what can be used instead?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Azure static files System.IO.DirectoryNotFoundException
Make sure your static files are part of your project. And mark them explicitly as content and Copy to output folder -> always....
Read more >Troubleshoot domain and TLS/SSL certificates - Azure App ...
Find solutions to the common problems that you might encounter when you configure a domain or TLS/SSL certificate in Azure App Service.
Read more >Troubleshooting Azure Static Web Apps - Microsoft Learn
Review server errors · Inside the Azure portal, open the Resource Group associated with your static web app. · Select the Application Insights ......
Read more >Limitations & known issues with SFTP in Azure Blob Storage
Learn about limitations and known issues of SSH File Transfer Protocol (SFTP) support for Azure Blob Storage.
Read more >Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
maybe it’s related in “OutgoingMessage.js”
I changed “OutgoingMessage.js” like below
function convertToBody(body, encoding) {
// return Buffer.isBuffer(body) ? body.toString(encoding) : body; //origin code return Buffer.isBuffer(body) && “binary” != encoding ? body.toString(encoding) : body;
}
and test like this
app.get(“/api/getfile”, function (req, res) {
});
It downloaded the file without “TypeError: Cannot read property ‘length’ of null”
That’s for the tip @CyrusNajmabadi , I found a different library that implemented
aws-serverless-express
for azure and it worked like a charm (https://github.com/bigx333/azure-aws-serverless-express).@yvele I do really like this library, and would switch back once this issue gets fixed. To give you more details, I was trying to serve a
ReadableStream
from azure blob storage through express and kept running into the headers issue.