aws-toolkit-jetbrains icon indicating copy to clipboard operation
aws-toolkit-jetbrains copied to clipboard

Invalid directory error on SAM build

Open jebricker opened this issue 5 years ago • 4 comments

Realize that this is my first Lambda and I am trying to test it locally. I am not sure if this is a bug or a configuration issue on my end.

To reproduce

This is running the lambda via right clicking on the lambda symbol in the left column of the Handler and select run (or debug) local.

Expected behavior Just hoping it will build and run.

C:\Users\eb96409\AppData\Roaming\Python\Python37\Scripts\sam.exe build --template C:\REGAPI\hubintergration\template.yaml --build-dir C:\REGAPI\hubintergration.aws-sam\build HandlerFunction 2019-09-24 14:38:10 Building resource 'HandlerFunction' 2019-09-24 14:38:12 Running JavaMavenWorkflow:CopySource

Error: JavaMavenWorkflow:CopySource - [WinError 267] The directory name is invalid: 'C:\REGAPI\hubintergration\vvAuth.jar' Build Failed

AWS toolkit 1.6

IntelliJ IDEA 2019.2.2 (Ultimate Edition) Build #IU-192.6603.28, built on September 6, 2019 Runtime version: 11.0.3+12-b304.56 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0 GC: ParNew, ConcurrentMarkSweep Memory: 1946M Cores: 12

C:\Users\eb96409>sam --version SAM CLI, version 0.16.1

jebricker avatar Sep 25 '19 12:09 jebricker

Could you please share the HandlerFunction resource from your SAM Template? I am wondering if your CodeUri and/or Handler fields are set up correctly.

An example of the "hello world" sample that gets created from the Toolkit looks like this:

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: HelloWorldFunction  # This is the folder relative to the template.yaml file
      Handler: helloworld.App::handleRequest # This is the Lambda handler signature
      Runtime: java8

awschristou avatar Sep 25 '19 20:09 awschristou

This could be the same issue as https://github.com/awslabs/aws-lambda-builders/issues/113 - sam build currently expects the CodeUri property to point to the root of the Maven project, not the build artifact (jar file).

jaapspiering avatar Jan 27 '20 11:01 jaapspiering

Me: Should it be referenced somewhere in the official documentation? Amazon: Does the Pope shit in the woods?

warbabun avatar Jan 31 '20 18:01 warbabun

is this going to be fixed? this basically prevents us from using assembly zips when using jetbrains toolkit

emaayan avatar Jan 02 '21 17:01 emaayan