dashboard-plugin icon indicating copy to clipboard operation
dashboard-plugin copied to clipboard

"Warning: Skipping wrapping for Function" when using Typescript function files

Open benzittlau opened this issue 9 months ago • 1 comments

I'm attempting to use Typescript with serverless and hit an issue with the dashboard plugin when I changed my function file from a .js extension to .ts. After this change I would see the following error when attempting to invoke my function or deploy it:

Warning: Skipping wrapping for Function: <Your Function Name Here>

This appears to be due to the check on line 38 in the wrapUtils.js file: https://github.com/serverless/dashboard-plugin/blob/897b76ea14d4f351c9e6f33b39ae2aa8281bdc24/lib/wrap-utils.js#L27-L47

Effectively if a node runtime is declared in the configuration file the function's file must have a .js extension or the dashboard plugin will skip wrapping the function. Consequently if the file is a typescript file with a .ts extension it won't be wrapped.

It's possible this plugin isn't intended to support typescript functions, but I wasn't able to find an explicit reference in documentation so I've created this issue in case it's intended that the plugin should support functions in Typescript files.

benzittlau avatar Sep 22 '23 20:09 benzittlau

Running into this as well using the serverless-esbuild plugin. I had a look into the zip when this warning is printed and the main difference is the serverless sdk isn't automatically included. I found some explanation of what this SDK is and how to include it when using a bundler https://www.serverless.com/framework/docs/guides/sdk/nodejs

I think the main consequence is that instrumentation isn't automatic. Would like the warning to better describe the tradeoffs though.

petegleeson avatar Nov 20 '23 08:11 petegleeson