aws / aws/aws-sam-cli

Jar not extracting correctly on Windows

Open
#2,475 4 comments 1 reaction 0 assignees View on GitHub
area/local/invoke area/local/start-api area/local/start-lambda maintainer/need-followup platform/windows
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
When trying to invoke my AWS lambda on localhost using AWS SAM, I get the following error for my jar:
```
...
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\lambdafn\zip.py", line 63, in _extract
return zip_ref.extract(file_info, output_dir)
File "zipfile.py", line 1630, in extract
File "zipfile.py", line 1701, in _extract_member
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\xxx\\AppData\\Local\\Temp\\tmp51be5i54\\org\\springframework\\boot\\autoconfigure\\integration\\IntegrationAutoConfiguration$IntegrationRSocketConfiguration$IntegrationRSocketClientConfiguration$RemoteRSocketServerAddressConfigured$WebSocketAddressConfigured.class'
...
```
Problem is in the `\AWSSAMCLI\runtime\Lib\site-packages\samcli\local\lambdafn\zip.py` file calling this `return zip_ref.extract(file_info, output_dir)`. The problem and the potential solution is described e.g. [here](https://stackoverflow.com/q/40419395/3242721).

### Steps to reproduce:
1. create spring project with aws lambda, use some really long name over 255 chars
2. build the shadow jar from your project
3. create `template.yaml` with your lambda, set `CodeUri` to reference your shadow jar
4. invoke your lambda, e.g. `sam local invoke -e event.json` when your lambda is consuming some sort of json
5. observe the error.

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

1. OS: win10 x64
2. `sam --version`: 1.13.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.