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

Cross platform deploy on aws cloudformation package breaks path seperators #8501

Open
pm-incyan opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels
bug This issue is a bug. cloudformation package-deploy customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@pm-incyan
Copy link

pm-incyan commented Jan 24, 2024

Describe the bug

If you try to deploy a Lambda layer/function from a Windows computer and target a runtime which is Linux based, for example the Python3.12 runtime, the dependencies do not work, because the auto-created zip file by aws cloudformation package includes Windows path seperators in the zip file. When the layer/function is extracted to the /opt directory within the Lambda environment the files are extracted but they include the literal backslash chararacters in their filenames and are flat within /opt. Therefore the depdendencies do not load at all.

Expected Behavior

The dependencies load correctly.

Current Behavior

The zip file is built with path seperator based on the environment where the aws cloudformation package command is run, so the depdencies do not load at run time when going cross-platform.

Reproduction Steps

Generate a Lambda layer from a local path using a tempalte, e.g.

BaseLayer:
    Type: AWS::Lambda::LayerVersion
    Properties:
      LayerName: BaseLayer
      Content: lambda/layers/base/dist
      CompatibleRuntimes:
        - python3.12
      CompatibleArchitectures:
        - x86_64

Run aws cloudformation package in a Windows environment, then use this layer in a Lambda function. If you list the contents of the /opt directory, for example by running:

import os
print(os.listdir("/opt"))

You can see the incorrect paths extracted to /opt that contain backslashes.

Possible Solution

Generate the zip file in a compatible format for the target environment.

OR

Add lambda support for extracting a zipfile using Windows path seperators.

Additional Information/Context

No response

CLI version used

aws-cli/2.15.6 Python/3.11.6 Windows/10 exe/AMD64 prompt/off

Environment details (OS name and version, etc.)

Windows 11 Pro / Lambda Python3.12

@pm-incyan pm-incyan added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2024
@tim-finnigan tim-finnigan self-assigned this May 17, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label May 17, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reporting this issue and your patience here. I was having some trouble reproducing this, could you provide the full command used and debug logs (with sensitive info redacted) by adding --debug to the command? That could help give us more insight into the issue. Have you also tried using the SAM CLI / sam deploy command as an alternative?

@tim-finnigan tim-finnigan added cloudformation package-deploy response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. cloudformation package-deploy customization Issues related to CLI customizations (located in /awscli/customizations) p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants