aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

HttpApi event type does not work with local start-api

Open Lanchez opened this issue 6 years ago • 19 comments

Description

I renamed all Api events from functions to HttpApi and sam local start-api gives error message Error: Template does not have any APIs connected to Lambda functions

Steps to reproduce

Create a function with event type HttpApi without any events of type Api and try to start local start-api

Observed result

Found '0' API Events in Serverless function with name 'XXX'
...
Removed duplicates from '0' Explicit APIs and '0' Implicit APIs to produce '0' APIs
0 APIs found in the template
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam local start-api', 'duration': 242, 'exitReason': 'UserException', 'exitCode': 1, 'requestId': '76b3766e-5990-4e27-ae83-98f7d13b012c', 'installationId': '9ce7efdf-c007-4c1d-920f-939c97325721', 'sessionId': 'e46aa880-3d79-4ae3-92e9-139ccddd56d0', 'executionEnvironment': 'CLI', 'pyversion': '3.7.5', 'samcliVersion': '0.37.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: Template does not have any APIs connected to Lambda functions

Expected result

Local api starts with HttpApi event type just like with Api event type.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 18.04
  2. sam --version: 0.37.0

Lanchez avatar Dec 05 '19 12:12 Lanchez

Good catch. This is on our immediate roadmap to support. Marking this as a feature request for visibility.

sanathkr avatar Dec 09 '19 17:12 sanathkr

I'm exploring HttpApi and came across this issue. When would this become available?

enobufs avatar Feb 04 '20 19:02 enobufs

Following...

apemberton avatar Feb 16 '20 17:02 apemberton

Following...

metaskills avatar Mar 11 '20 23:03 metaskills

Does it work with local invoke?

metaskills avatar Mar 11 '20 23:03 metaskills

Adding some context. I have noticed that v0.45.0 does add full support for AWS::Serverless::HttpApi which I think was error'ing out for me prior on properties like Tags.

But in order for our team to update our highest invoked Lambda to HTTP API, we need the start-api feature to work since we use that for integration tests server.

metaskills avatar Mar 19 '20 00:03 metaskills

Tested on version v0.45.0 Any updates on this (ETA)? I have to manually set Event to Api instead of HttpApi when I want to test locally which not the best flow.

MartinMasek avatar Apr 01 '20 15:04 MartinMasek

I updated sam to v0.47.0 and still HttpApi not working with local start-api

amrabdelshafi97 avatar Apr 06 '20 11:04 amrabdelshafi97

Hi,

Is there any update? Also in my organization we are waiting for this feature.

Thanks!

davidpach avatar Apr 24 '20 00:04 davidpach

Hi guys, I just add HttpApi support in local start-api. You can see the MR #1942.

pyk avatar Apr 25 '20 14:04 pyk

+1 to this guys, as soon as people discover HttpApi and how faster and cheaper it is , this will become a big missing feature

rasensio avatar May 12 '20 06:05 rasensio

@sanathkr Is there any update on this please? We're starting a new project and I noticed it's not done yet. PR from @pyk has 1 not passing test. Seems we could be almost there :)

MartinMasek avatar Jun 07 '20 20:06 MartinMasek

+1

InspectorDeno avatar Jun 11 '20 13:06 InspectorDeno

This is so close to being fixed - thanks for your work @pyk!

@sanathkr can you please confirm if the only thing holding back @pyk's PR being merged is the failing test? Looks like there's a comment on the PR how to fix it already, but if @pyk is too busy I can re-branch and add it to his work...

rowanu avatar Jun 14 '20 23:06 rowanu

I've updated my PR, now all tests are passed successfully 🙏

pyk avatar Jun 15 '20 10:06 pyk

Thanks @pyk! 🙇

@jfuss any chance you can have a look at this one and let us know what's needed to be able to merge it? It's a big blocker to using the new HTTP API like the old REST API in SAM 🐿️ 🙏

rowanu avatar Jun 15 '20 10:06 rowanu

Is this supposed to be fixed ? I can still reproduce this

sam --version
SAM CLI, version 0.53.0

sebsto avatar Jul 16 '20 15:07 sebsto

just tested this with 1.0.0, still not possible

drissamri avatar Aug 05 '20 14:08 drissamri

Yeah with 1.0.0, still doesn't work, it would have been nice to be able to test the api locally!

saminnet avatar Aug 05 '20 19:08 saminnet