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

AWS.invoke does not work, but it works with serverless-offline pkg #12

Open
clapas opened this issue Aug 8, 2019 · 1 comment
Open

Comments

@clapas
Copy link

clapas commented Aug 8, 2019

Using "serverless-offline-python": "^3.22.1"
-> Does not work as explained in https://www.npmjs.com/package/serverless-offline#usage-with-invoke

Using "serverless-offline": "^5.10.1"
-> Does work.

@CountZachula
Copy link

I am experiencing the same problem. Calling Invoke with any configuration seems to yield a 404. Switching from "serverless-offline-python" to "serverless-offline" resolves the issue.

Although this sample code may not work entirely, I'm merely demonstrating the invoke portion.

# handler.py

import json
import boto3

client = boto3.client(
    'lambda',
    endpoint_url='http://localhost:3000',
    region_name='eu-central-1',
    use_ssl=False
)
    
def other(event, context):
    response = {
        "statusCode": 200,
        "body": json.dumps({})
    }
    return response

def hello(event, context):
    response = client.invoke(
        FunctionName='hello-dev-other',
        InvocationType='RequestResponse',
        Payload=json.dumps({})
    )
    return response
# serverless.yml

service: hello
provider:
  name: aws
  runtime: python3.6
  region: eu-central-1

plugins:
  # - serverless-offline
  - serverless-offline-python

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: "/hello"
          method: get
  other:
    handler: handler.other

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

2 participants