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

error: Plugin ‘AWSLambdaPackager’ was denied permission to allow docker unix domain socket connections. #420

Open
djryanash opened this issue Oct 28, 2024 · 1 comment
Assignees
Labels
packager The SwiftPM archive plugin

Comments

@djryanash
Copy link

djryanash commented Oct 28, 2024

Expected behavior

After using swift package --disable-sandbox archive in the Terminal, I expected the command to create the AWS Lambda ZIP package.

Actual behavior

The command swift package --disable-sandbox archive failed with an error:

Plugin ‘AWSLambdaPackager’ wants permission to allow docker unix domain socket connections.
Stated reason: “This plugin uses Docker to create the AWS Lambda ZIP package.”.
Allow this plugin to allow docker unix domain socket connections? (yes/no) y
error: Plugin was denied permission to allow docker unix domain socket connections.

Steps to reproduce

I am following this talk Swift, Server-Side, Serverless - Sébastien Stormacq

  1. I created a package using swift CLI: swift package init --type executable --name MyFinalLambdaFunction
  2. I opened the project in Xcode and added the dependencies:
let package = Package(
    name: "swict-aws-lambda-runtime-example",
    platforms: [
        .macOS(.v15)
    ],
    products: [
        .executable(name: "HttpApiLambda", targets: ["HttpApiLambda"])
    ],
    dependencies: [
        .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", branch: "main"),
        .package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", branch: "main")
    ],
    targets: [
        .executableTarget(
            name: "HttpApiLambda",
            dependencies: [
                .product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
                .product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
            ]
            //path: "./HttpApiLambda"
        )
    ]
)
  1. From Terminal, I built the project: swift build --disable-sandbox
  2. Then I ran swift package --disable-sandbox archive at which point I got the error.
  3. I checked that AWS and Docker were correctly installed as well:
>> where aws
/usr/local/bin/aws
/usr/local/bin/aws
…/Documents/xcode-projects/MyFinalLambdaFunction via 🐦 v6.0 
>> where docker
/usr/local/bin/docker
/usr/local/bin/docker
…/Documents/xcode-projects/MyFinalLambdaFunction via 🐦 v6.0 
>> 

As a side note, I am also getting this in Xcode.

invalid custom path './HttpApiLambda' for target 'HttpApiLambda'

If possible, minimal yet complete reproducer code (or URL to code)

See code above to minimally reproduce.

What version of this project (swift-aws-lambda-runtime) are you using?

1.0.0-alpha.3

Swift version

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: x86_64-apple-macosx15.0
Darwin 2020-MacBook-Pro-Ryan.local 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:54:30 PDT 2024; root:xnu-11215.1.10~2/RELEASE_X86_64 x86_64

Amazon Linux 2 docker image version

No response

@sebsto
Copy link
Contributor

sebsto commented Nov 7, 2024

I'm sorry to read you're experiencing this problem.

From your Package.swift file, I can see you're using the code from the Main branch of the runtime, not the 1.0.0-alpha.3

        .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", branch: "main"),

The main branch is our work toward the runtime API v2. You don't need to disable the full plugin sandbox anymore. You can package and archive with this command:

swift package archive --allow-network-connections docker

You will find full examples in the Examples directory..

Please follow this new docs and examples code and report any issue you might have with these.

@sebsto sebsto self-assigned this Nov 7, 2024
@sebsto sebsto added the packager The SwiftPM archive plugin label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packager The SwiftPM archive plugin
Projects
None yet
Development

No branches or pull requests

2 participants