Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Proxy integration to Lambda is incorrect. #244

Closed
gantzm opened this issue Jan 1, 2018 · 5 comments
Closed

HTTP Proxy integration to Lambda is incorrect. #244

gantzm opened this issue Jan 1, 2018 · 5 comments

Comments

@gantzm
Copy link

gantzm commented Jan 1, 2018

Using a template like the following (see below) the "resource" attribute of the proxy JSON should be set to /rest/getId/{token}.

When issuing a GET call to /rest/getId/MyId, I would expect to see:

{
  "resource": "/rest/getId/{token}",
  "path": "/rest/getId/MyId"
}

Instead I receive the following:

{
  "resource": "/rest/getId/MyId",
  "path": "/rest/getId/MyId"
}

This is contrary to how HTTP Proxy works with API Gateway.

Sample Template:

Resources:
  MyResource:
    Type: AWS::Serverless::Function
    Properties:
      Handler: com.MyHandler
      CodeUri: MyHandler.zip
      Runtime: java8
      MemorySize: 512
      Timeout: 30
      Role:
        Fn::ImportValue:
          !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']]
      Events:
        GetId:
          Type: Api
          Properties:
            Path: /rest/getId/{token}
            Method: get
@gantzm
Copy link
Author

gantzm commented Jan 2, 2018

I've spent some time trying to fix this myself but have encountered some difficulties. First, this is my first adventure into Go so I'm having a few issues groking the language itself. Second, it looks like to fix this I need to somehow get the "resource" property copied into the handler as the handler doesn't retain a reference back to the configuration data.

It's this layer of abstraction that I'm having some issues with.

@fdesoye
Copy link

fdesoye commented Jan 10, 2018

+1

@kind3r
Copy link

kind3r commented Feb 2, 2018

Also missing requestContext.apiId
Should I add a separate issue ?

@valtlfelipe
Copy link

I'm missing requestContext.apiId too, without it, vandium does not work

@jfuss
Copy link
Contributor

jfuss commented May 10, 2018

The initial issue @gantzm reported has been corrected in the 0.3.0 release. Closing since this has been addressed.

@kind3r and @valtlfelipe requestContext.apiId was added to the event and given a default value in the release 0.3.0 as well. Code can be found here: https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/local/events/api_event.py#L67

@jfuss jfuss closed this as completed May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants