awslabs / aws-lambda-powershell-runtime

This new PowerShell custom runtime for AWS Lambda makes it even easier to run Lambda functions written in PowerShell to process events.
Apache License 2.0
59 stars 20 forks source link

Runtime.InvalidEntrypoint #23

Closed sholland-bamboohealth closed 1 year ago

sholland-bamboohealth commented 1 year ago

When I try to test the deployed function I get the following error. Building with Powershell entirely and deploying with SAM deploy -g

{
  "errorType": "Runtime.InvalidEntrypoint",
  "errorMessage": "RequestId: 7c726fb8-d259-4e0f-b170-a1ed98a4a4d6 Error: fork/exec /opt/bootstrap: exec format error"
}

Function Logs
START RequestId: 7c726fb8-d259-4e0f-b170-a1ed98a4a4d6 Version: $LATEST
RequestId: 7c726fb8-d259-4e0f-b170-a1ed98a4a4d6 Error: fork/exec /opt/bootstrap: exec format error
Runtime.InvalidEntrypoint
END RequestId: 7c726fb8-d259-4e0f-b170-a1ed98a4a4d6
REPORT RequestId: 7c726fb8-d259-4e0f-b170-a1ed98a4a4d6  Duration: 4.88 ms   Billed Duration: 5 ms   Memory Size: 1024 MB    Max Memory Used: 2 MB   
XRAY TraceId: 1-64e5154e-195741d82091909246cce304   SegmentId: 4095cefb72289e67 Sampled: true
juancrl commented 1 year ago

+1. Exactly the same error. Everything seems built and deployed ok, and the 2 custom layers can be seen on the console. However, running the function gives that error ::

Function Logs START RequestId: f6cafea3-fbcf-42bc-803e-af713dc9566f Version: $LATEST RequestId: f6cafea3-fbcf-42bc-803e-af713dc9566f Error: fork/exec /opt/bootstrap: exec format error Runtime.InvalidEntrypoint

sholland-bamboohealth commented 1 year ago

Agreed. I was wondering if I needed to check my rights but I would assume if I can build and deploy then I've got the rights to kick it off.

juancrl commented 1 year ago

I've reinstalled SAM and the custom runtime. Same behaviour.

austoonz commented 1 year ago

It seems like we've battled this issue since we first built this runtime. Building the runtime entirely on Windows, without using sam build tends to end with this issue, which I believe is related to the /opt/bootstrap file not having the execute bit set correctly.

I'm yet to have a solution to this, other than when I need to do things I do it using WSL, macOS, Linux, etc.

Will keep this issue open until we figure out a solution.

sholland-bamboohealth commented 1 year ago

So instead of using .\build-layers.ps1, i should use option Asam build --parallel?

juancrl commented 1 year ago

I've tried all 3 build options with the same results... but maybe the fact I run .\build-layers.ps1 has some permanent effect on the subsequent tests, Could be somehow related to having installed different versions of (fff*****) python ? Just a feeling. I'll retry all steps later, after a good cleanup + reboot. And also in a second computer (when back home after the weekend).

juancrl commented 1 year ago

I've rebuilt everything. Running the process from inside WSL and the MS-provided Ubuntu, and NOT calling ./building_layers.ps1, has done the trick. I also tried on Amazon2 linux WSL, but the wget/apt commands are different and I don't want to learn those arcane syntax when PowerShell/pwsh could be there. Please add them to the docs... :-)

sholland-bamboohealth commented 1 year ago

Agreed, once i moved away from the ./building_layers.ps1 and got make installed on the wsl installed Ubuntu...everything was fine. @austoonz I do think it would help having a note about make being a pre-req but not coming with the MS Ubuntu distro.

austoonz commented 1 year ago

@sholland-bamboohealth Agreed. I actually just pushed this commit which adds a note about that above the sam build commands.

sholland-bamboohealth commented 1 year ago

thank you all for working with me...on this...