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

Internal Server Error / Runtime.ExitError #13

Open
connerdassen opened this issue Mar 4, 2024 · 2 comments
Open

Internal Server Error / Runtime.ExitError #13

connerdassen opened this issue Mar 4, 2024 · 2 comments

Comments

@connerdassen
Copy link

I cannot get this to work whatsoever, and because of a lack of logs I don't know where it's going wrong.
I have a Laravel project that I want to deploy using the CDK like this:

this.backend = new PhpFpmFunction(this, `Backend-${STAGE}`, {
            handler: 'public/index.php',
            code: packagePhpCode('code/backend'),
            phpVersion: '8.3',
            vpc: props.vpc
}

It all deploys fine, but when visiting the resulting URL, I get an Internal Server Error, with the CloudWatch containins only this:

INIT_REPORT Init Duration: 404.55 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError
START RequestId: dc4f6c9f-eee8-44d2-82ea-317cda3ac07b Version: $LATEST
RequestId: dc4f6c9f-eee8-44d2-82ea-317cda3ac07b Error: Runtime exited with error: exit status 255 Runtime.ExitError

No further useful info at all.

I tried debugging locally using docker and found out the same Runtime.ExitError happened there, which was due to not having bref/bref and bref/laravel-bridge installed.

However, after installing, the error went away locally, but it still happens on Lambda after redeploying.
I did notice that when I download the code from lambda, the vendor directory only contains aws/ and autoload.php, not any of the dependencies. If I run locally on docker with only these present, I also get a Runtime.ExitError.

@connerdassen
Copy link
Author

It seems that missing packages in vendor are indeed the problem; something causes packagePhpCode to not include anything other than vendor/aws and vendor/autoload.php.
After manually zipping and using lambda.Code.fromAsset, the lambda includes all packages in vendor and it works.

@connerdassen
Copy link
Author

It seems to still not work perfectly, the invocation itself succeeds now, but I'm getting a 500 internal server error response on any path. CloudFront now looks like this:

REPORT RequestId: 9902b69e-2126-4df7-89f9-e7f3603debab	Duration: 1.77 ms	Billed Duration: 2 ms	Memory Size: 1024 MB	Max Memory Used: 89 MB	
START RequestId: 5887e595-a18e-4193-9563-0441d6d35083 Version: $LATEST
[AWS Parameters and Secrets Lambda Extension] 2024/03/04 03:02:03 INFO ready to serve traffic
END RequestId: 5887e595-a18e-4193-9563-0441d6d35083

with no output from PHP or Laravel at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant