aws-samples / aws-sam-swift

SAM Templates for Server-side Swift on AWS
MIT No Attribution
4 stars 1 forks source link

Main file can not be named `main.swift` #4

Closed sebsto closed 9 months ago

sebsto commented 9 months ago

As per the Swift runtime for AWS Lambda, the main file can not be named main.swift

Note that the file can not be named main.swift or you will encounter the following error: 'main' attribute cannot be used in a module that contains top-level code.

https://github.com/swift-server/swift-aws-lambda-runtime

While a basic build works with Swift 5.8 and swift 5.9, it breaks some other library, such as the OpenAPIGenerator

Fix : rename the main file from the template to LambdaHandler or any other name

sebsto commented 9 months ago

submitted https://github.com/aws-samples/aws-sam-swift/pull/5 to fix this