aws-sam-cli
                                
                                 aws-sam-cli copied to clipboard
                                
                                    aws-sam-cli copied to clipboard
                            
                            
                            
                        ClassNotFoundException in package that works fine on Lambda
I have a Lambda + API Gateway deployment working fine, but when I try to invoke the same ZIP file locally I get a ClassNotFoundException  for the same handler string as the one in the Lambda Console.
I am invoking it with:
>sam local start-api --template sam.yaml
My sam.yaml is:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Users API Endpoint
Globals:
  Api:
    EndpointConfiguration: REGIONAL
Resources:
  UsersFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: com.myproject.users.StreamLambdaHandler::handleRequest
      Runtime: java8
      CodeUri: lambda/build/distributions/lambda-1.0.0-SNAPSHOT
      MemorySize: 320
      Policies: AWSLambdaVPCAccessExecutionRole
      Timeout: 20
      Events:
        GetResource:
          Type: Api
          Properties:
            Path: /users/{proxy+}
            Method: any
Outputs:
  UsersApi:
    Description: URL for application
    Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/users'
    Export:
      Name: UsersApi
- OS: Windows
- sam --version: 0.17.0
was the project built with sam build, before being invoked? if you did can you check .aws-sam/build directory to see if the class files and jars are present?
Yes, and it didn't made any difference, BUT if I unzip the deployment package myself, on the same folder (same thing that SAM does), it works.
Given the age on this issue, I am going to close it. This is from a very old version (we are on 1.72.0 now).
If something is still not working as expected on newer versions, please create a new issue so we can investigate. I fully working example so we can easily repro would be very helpful too.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.