I have a serverless SAM-based service that has multiple Application resource referencing local templates, but running the template locally (with sam local start-api) doesn't seem to recognize the nested applications.
Is it possible to run all of the referenced Applications as a single service locally?
Thanks
Can you describe this use case in a bit more detail? Something like an example of the template(s) would be useful for scoping this work. Feel free to anonymize out any details, mostly interested in the different templates and how they're relating to each other.
Facing the same problem here, I'll try to add more context to the problem.
My team has multiple template.yml each template represent an API that we use, see the graph bellow:
src/
โ โโโ contracts/
โ โ โโโ functions...
โ โ โโโ template.yml
โ โโโ simulations/
โ โ โโโ functions...
โ โ โโโ template.yml
| โโโ template.yml
So contracts and simulations will have their own template.yml that will contain all lambdas declarations and events.
Then on template.yml of src we declare this API's as nested applications, like this:
Resources:
APIDomainName:
Type: "AWS::ApiGateway::DomainName"
Properties:
# # API: Contracts
ContractsApp:
Type: AWS::Serverless::Application
Properties:
Location: src/contracts/template.yaml
Parameters:
# # API: Simulations
SimulationsApp:
Type: AWS::Serverless::Application
Properties:
Location: src/simulations/template.yaml
Parameters:
What we want is that when we start a local api with sam local start-api on src folder their nested applications will be started too with their API's. Currently, an error is returned because we do not have any http event on this template.yml (this events are on the nested applications).
This will be an awesome feature to sam thanks for this CLI btw.
@gerhardberger Do you find any workaround for this?
Hi, we also would like to have a feature like that: right now, during development, we use to run local start-api over the single nested stacks, but it doesn't scale a lot...
I have a very similar use as as @netochaves , with exception of running sam local start-lambda . Is there any word on making this happen ?
I'm worried that without this, my team won't be able to scale development with lambdas
We are facing same issue when working with multiple child stacks.
Rootstack (yaml)
-Child1 (yaml) (all apis)
-Child2(yaml) (few events)
Command & output:
sam local start-api --parameter-overrides EnvironmentValue=Dev
Error: Template does not have any APIs connected to Lambda functions
Command & output:
sam local start-api --parameter-overrides EnvironmentValue=Dev -t Child1_api.yaml
Error: Fn::FindInMap is an Invalid Layer Arn.
Can everybody use the thumbs-up react on the first comment so this can have a higher visibility for the dev team?
Most helpful comment
Facing the same problem here, I'll try to add more context to the problem.
My team has multiple
template.ymleach template represent an API that we use, see the graph bellow:So
contractsandsimulationswill have their owntemplate.ymlthat will contain all lambdas declarations and events.Then on
template.ymlofsrcwe declare this API's as nested applications, like this:What we want is that when we start a local api with
sam local start-apionsrcfolder their nested applications will be started too with their API's. Currently, an error is returned because we do not have any http event on this template.yml (this events are on the nested applications).This will be an awesome feature to
samthanks for this CLI btw.@gerhardberger Do you find any workaround for this?