Thursday, 4 May 2017

500 Internal Server Error when trying to access CSV file on Microsoft Azure node.js/express web app?

This is the first time I've tried setting a node app up in this kind of environment - so I'm not sure if I could have made a simple mistake somewhere. I'm not completely sure how I could debug this further either.

I'm using express-generator to scaffold initial app, then using csv-parse to read a csv file and send the contents as a route response.

router.get('/data', (req, res, next) => {
    fs.createReadStream('db.csv')
        .pipe(parse({
                delimiter: ';'
            }, (err, data) => {
                if (err) {
                    res.send(err)
                }

                res.send(data)
            })
        )
})

csv file is at the root level of the app, here is the folder structure;

enter image description here

I'm using git to integrate with azure, using the free web plans.

When I load the route when hosting the app locally, it returns the response with the contents of the csv file. If I try load the route on the hosted azure app, I get a 500 (Internal Server Error) with no further information.

I'm not sure what the problem could be? or, I'm not sure how I could generate a more detailed error response to help point me in the right direction?



via since095

No comments:

Post a Comment