question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running local api for nested serverless application locally

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
netochavescommented, Feb 12, 2020

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?

7reactions
made2591commented, Mar 10, 2020

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running API Gateway locally - AWS Documentation
Start a local instance of API Gateway using the sam local start-api AWS SAM CLI command.
Read more >
AWS SAM Accelerate and nested stacks - Serverless Land
See how AWS SAM Accelerate speeds up deployment from your local ... live office hours to learn about building serverless applications.
Read more >
Using Serverless Framework with AWS – Best Practices
This plugin emulates AWS Lambda and API Gateway on your local machine. ... these two plugins, you can setup most of your serverless...
Read more >
Plugin Repository - Serverless Framework
Emulate AWS λ and API Gateway locally when developing your ... Serverless Dynamodb Local Plugin - Allows to run dynamodb locally for serverless....
Read more >
AWS SAM Template - Local Testing - Stack Overflow
The function has been created before the API Gateway. You can use DependsOn parameter to create the API before the method.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found