Skip to content

AWS Lambda error: forkpty(3) failed.

0

Trying to run terraform cdktf in a lambda and getting this error:

Error: forkpty(3) failed.

It works fine when tested locally with the Runtime Interface Emaulator, but failed when depoyed to a lambda function. I'm using a container image for deployment, based on Amazon Linux (node 20 and also tried node 18).

Using an sh script to trigger deployment.

asked 2 years ago372 views

3 Answers
0

I am pretty sure that this is related to running headless in Lambda. A PTY device is a pseudo-tty device which is part of an interactive session. When running from Lambda your process will not have a PTY device and as such is failing to fork a pty session.

AWS
EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • This is my thinking as well, although I can run it locally (docker run ...). I'll post it in the cdktf issue tracker and see if there's anything that can be done about it (I'm already using the CI flag which I'd expect disables UI interaction).

0

Hi,

It seems that your runtime environment is failing on this Python package https://github.com/microsoft/node-pty bridging NodeJS to Python

Has this Python package already been imported in your container image?

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Hey, Thank you for picking this up. I've added the npm package to the image and it made no difference. Would have expected this to be a dependency of cdktf but couldn't find it in the package-lock.json file. Regardless, I'm getting the same error.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.