aws-lambda-dotnet
aws-lambda-dotnet copied to clipboard
Inability to use Serverless template variables
Description
Expected to be able to use Serverless Framework self
variables throughout the template .yml
. Instead tool fails with GUI reporting:
FileLoadException: The given assembly name or codebase was invalid. (0x80131047)
Reproduction Steps
-
aws-lambda-tools.default.json
indicates templateserverless.yml
-
serverless.yml
looks like with variable${self:service}
where service name matches project/folder nameservice: My.Namespace.And.Solution.Project provider: name: aws runtime: dotnetcore3.1 package: individually: true functions: hello: handler: ${self:service}::${self:service}.Handler::HelloWorld ...
-
launch.json
in VSCode calls"program": "/Users/${env:USERNAME}/.dotnet/tools/dotnet-lambda-test-tool-3.1"
- Run debugging tool, GUI opens in browser with "Stack" tab showing error and trace
- Replace all instances of variable in
serverless.yml
template with explicit service name - Run debugging tool, GUI opens in browser with working mock testing tool
Logs
?
Environment
- Build Version: dotnet-lambda-test-tool-3.1 v0.10.0, dotnet-lambda v5.2.0
- OS Info: Windows 10 Pro
- Build Environment: VSCode +
dotnet
- Targeted .NET Platform: Core 3.1
Resolution
Maybe the pre-parsing/transpiling is a feature that hasn't been implemented yet? Or is this specific to Serverless runtimes?
This is a :bug: bug-report
Followup -- tried creating a custom variable section instead of the service name, but it doesn't work either:
service: My-Shorter-Namespace-Without-Periods
custom:
dotnetProj: My.Project.That.Has.Periods
provider:
name: aws
runtime: dotnetcore3.1
package:
individually: true
functions:
hello:
handler: ${self:custom.dotnetProj}::${self:custom.dotnetProj}.Handler::HelloWorld
package:
artifact: bin/release/netcoreapp3.1/${self:custom.dotnetProj}.zip
@zaus We had discussion with the team. We do not have first class support for serverless framework, but any PR(s) are welcome. Changing this to feature request. Feel free to contribute in the form of PR.