serverless-sam icon indicating copy to clipboard operation
serverless-sam copied to clipboard

Error Trying to Generate SAM Template

Open tfendt opened this issue 6 years ago • 1 comments

I am getting the below error when trying to generate a SAM template and I am not having any luck finding a solution. Is this a bug with the latest serverless-sam? I can do all other serverless commands with out issue this only happens when I try to run serverless sam export.

Type Error ---------------------------------------------

Cannot use 'in' operator to search for '0' in ${file(../shared/build/slsFunctionLoader.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 Issues: forum.serverless.com

Your Environment Information --------------------------- OS: win32 Node Version: 8.12.0 Serverless Version: 1.44.1

tfendt avatar Jun 04 '19 21:06 tfendt

It looks like the plugin does not read in references to files. When I copy and paste the functions directly in the serverless file then the command succeeds.

However it also doesn't account for the variables defined outside of the serverless file. EX: ${file(../../serverless.env.yml):${opt:stage}

It just reads through the serverless file as is and doesn't substitute anything.

tfendt avatar Jun 05 '19 18:06 tfendt