aws-toolkit-jetbrains: Cannot find handler .. in project when not using lambda_handler as a function

Describe the bug I cannot run my lambda function locally because the handler cannot be found.

To reproduce

  1. Use example from here
  2. Add run configuration (AWS Lambda -> Local)
  3. Set runtime, Credentials and Region
  4. Set Handler to “app.lambda_handler”
  5. Error: Cannot find handler 'app.lambda_handler' in project.

Expected behavior It should run the function specified in the lambda_handler variable, see second screenshot

Screenshots image image

Your Environment

  • OS: Windows 10 Pro 1809
  • JetBrains’ Product: PyCharm Professional
  • JetBrains’ Product Version: PyCharm 2019.2.1 (Professional Edition), Build #PY-192.6262.63, built on August 22, 2019
  • Toolkit Version: 1.5
  • SAM CLI Version: 0.21.0
  • Python Version: 3.7

Additional context

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 4
  • Comments: 23 (8 by maintainers)

Most upvoted comments

Node 12 support is done in master but not yet released.

@snowe2010 The problem for me ended up being the signature of the exports.handler function…

exports.handler = async (event, context, callback) => {

Doesn’t work for me however when I change it to

exports.handler = async (event, context) => {

or

exports.handler = async event => {

I am able to run the function. I also have not marked any directories and in my template.yaml I have

Resources:
  ImageProcessFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: image-process
      Handler: app.handler

the function file relative to the project root is image-process/app.js

Hope this helps 😃

Node 12 support is done in master but not yet released.

Is node12 support done? I’m seeing the same issue, but changing to node10 doesn’t work.