serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 162 forks source link

Integration with serverless-plugin-typescript #563

Open Honatas opened 3 years ago

Honatas commented 3 years ago

This is a Feature Proposal

Description

When using this plugin with serverless-plugin-typescript, the scriptFile will be in a different location (.build folder). We need a way to tell serverless-azure-functions to get the files from that folder.

I have just run sls create -t azure-nodejs -p and then changed the extension of the hello.js and goodbye.js files to ts, as well as installed serverless-plugin-typescript. When running serverless, I get this error: The 'hello' function is in error: Invalid script file name configuration. The 'scriptFile' property is set to a file that does not exist.

This happens because of the generated function.json, it sets "scriptFile" to the location of the .ts file. It should set it to the location of the transpiled file on .build folder. So, instead of "../src/handlers/hello.js", it should be "../.build/src/handlers/hello.js".

I have manually replaced the function.json file with the correct configuration and everything works fine. We just need it done automatically.