aws / aws/aws-lambda-dotnet

Inability to use Serverless template variables

Aperta
#1,078 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature-request module/lambda-test-tool p3 queued
Lingua principale
C#
Stelle
1.7k
Fork
503
Merge medio
1g 18h
PR unite (30g)
21

Descrizione

## Description
Expected to be able to use [Serverless Framework `self` variables](https://www.serverless.com/framework/docs/providers/aws/guide/variables#reference-properties-in-serverlessyml) throughout the template `.yml`. Instead tool fails with GUI reporting:

> FileLoadException: The given assembly name or codebase was invalid. (0x80131047)

## Reproduction Steps

1. `aws-lambda-tools.default.json` indicates template `serverless.yml`
2. `serverless.yml` looks like with variable `${self:service}` where service name matches project/folder name
```yml
service: My.Namespace.And.Solution.Project

provider:
name: aws
runtime: dotnetcore3.1

package:
individually: true

functions:
hello:
handler: ${self:service}::${self:service}.Handler::HelloWorld
...
```
3. `launch.json` in VSCode calls `"program": "/Users/${env:USERNAME}/.dotnet/tools/dotnet-lambda-test-tool-3.1"`
4. Run debugging tool, GUI opens in browser with "Stack" tab showing error and trace
5. Replace all instances of variable in `serverless.yml` template with explicit service name
6. 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con aws-lambda-tools.default.json e l'esempio serverless.yml, quindi esegui dotnet-lambda-test-tool-3.1 tramite la configurazione launch.json per riprodurre la FileLoadException. Confronta l'handler basato su variabili che non funziona con la versione con il nome del servizio esplicito; il lavoro è completato quando le variabili del template funzionano e la GUI del browser si apre senza l'errore dell'assembly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, csharp, vscode, yaml
Ambito
developer-experience, devtools
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.