serverless-plugin-typescript icon indicating copy to clipboard operation
serverless-plugin-typescript copied to clipboard

on Azure.

Open Nipol opened this issue 7 years ago • 7 comments

When I deployed the example in the example directory, I get the following error:

`❯ sls deploy Serverless: Compiling with Typescript... handler.ts (3,42): Cannot find name 'setTimeout'. Serverless: Packaging service... Serverless: Logging in to Azure Serverless: Looking for deployed functions that are not part of the current deployment... Serverless: Creating resource group: -rg Serverless: Creating function app: Serverless: Waiting for Kudu endpoint... Serverless: Parsing Azure Functions Bindings.json... Serverless: Building binding for function: hello event: httpTrigger Serverless: Packaging function: hello

Error --------------------------------------------------

 ENOENT: no such file or directory, stat '/Users/nipol/Project/<project name>/handler.js'

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Forums: forum.serverless.com Chat: gitter.im/serverless/serverless

Your Environment Information ----------------------------- OS: darwin Node Version: 6.10.0 Serverless Version: 1.11.0 ` The handler.ts file is not converted to handler.js. Where should I approach that plugin?

Nipol avatar Apr 22 '17 09:04 Nipol

@pmuens do you have any idea what might be the issue here? We've just tested this on AWS.

schickling avatar Apr 22 '17 13:04 schickling

Hmm. 🤔 hard to tell without a stack trace.

@Nipol could you run the command again after setting the SLS_DEBUG=* environment variable? Thanks!

pmuens avatar Apr 24 '17 06:04 pmuens

Error: ENOENT: no such file or directory, stat '/Users/nipol/Project/projectname/handler.js'
at Error (native)
at Object.fs.statSync (fs.js:1000:11)
at Object.statSync (/Users/nipol/Project/projectname/node_modules/graceful-fs/polyfills.js:297:22)
at Object.copySync (/Users/nipol/Project/projectname/node_modules/fs-extra/lib/copy-sync/copy-sync.js:31:86)
at BbPromise (/Users/nipol/Project/projectname/node_modules/serverless-azure-functions/provider/azureProvider.js:636:11)
at AzureProvider.createZipObjectAndUploadFunction (/Users/nipol/Project/projectname/node_modules/serverless-azure-functions/provider/azureProvider.js:624:8)
at serverless.service.getAllFunctions.forEach (/Users/nipol/Project/projectname/node_modules/serverless-azure-functions/deploy/lib/createFunctions.js:15:49)
at Array.forEach (native)
at AzureDeploy.createFunctions (/Users/nipol/Project/projectname/node_modules/serverless-azure-functions/deploy/lib/createFunctions.js:12:47)
at runCallback (timers.js:666:20)
at tryOnImmediate (timers.js:639:5)
From previous event:
at PluginManager.invoke (/Users/nipol/.nvm/versions/node/v6.10.2/lib/node_modules/serverless/lib/classes/PluginManager.js:210:22)
at PluginManager.run (/Users/nipol/.nvm/versions/node/v6.10.2/lib/node_modules/serverless/lib/classes/PluginManager.js:225:17)
at Serverless.run (/Users/nipol/.nvm/versions/node/v6.10.2/lib/node_modules/serverless/lib/Serverless.js:97:31)
at serverless.init.then (/Users/nipol/.nvm/versions/node/v6.10.2/lib/node_modules/serverless/bin/serverless:23:50)

Wow 😵 This is a burden to me. In addition to explaining the situation. The ".build" folder is created and then removed. There is a Transpiled javascript file in the zip of the ".serverless" folder. Please let me know if I can help you. @pmuens

Nipol avatar Apr 24 '17 11:04 Nipol

@Nipol thanks for the detailed information 👍

Just looked into the code of the plugin here. Nothing suspicious so far.

It looks like the Azure functions provider plugin tries to access the file but is not able to do so.

I would recommend to open up an issue in the Azure Functions provider plugin (https://github.com/serverless/serverless-azure-functions/issues).

Since the transpilation step which this plugin does works just fine.

Just a quick note. The Azure functions plugin seems to be looking for a handler.js file. Could it be that you have a handler.ts file after transpiling with this plugin? That could be the root cause for this bug.

pmuens avatar Apr 28 '17 07:04 pmuens

I see. 🤔 I need to check the azure plugin team and its issues, make sure that they are different from the AWS plugin, and make adjustments. In addition, handler.ts in the file location handler.js in the same folder seems to recognize. However, the behavior of the plugin is to delete the Transpiled file after it has been put into the .build folder and bundled with the zip file. But looking for the handler.js file again is not a fundamental problem with this plugin.

Nipol avatar Apr 28 '17 13:04 Nipol

@Nipol could you the try same command with the latest version v1.0.0. It should work now. Thanks

RomanHotsiy avatar Jul 25 '17 20:07 RomanHotsiy

This is still broken in v1.1.2

caseyWebb avatar Sep 02 '17 23:09 caseyWebb