Closed jusmark123 closed 1 year ago
The vendor directory is uploaded to the serverless deployment bucket.
Does the bucket still exist and does it contain the vendor archive?
Yes, I checked the bucket is there and the .serverless folder with the vendor.zip is present. It's intermittent, so I'm not sure what is causing it. The function runs as expected sometimes, but then is suddenly starts failing with the above error.
2022-07-27T20:54:45 START RequestId: 07931007-5b63-4f86-a202-bc1da684a811 Version: $LATEST
2022-07-27T20:56:56 PHP Deprecated: ZipArchive::open(): Using empty file as ZipArchive is deprecated in /opt/bref/breftoolbox.php on line 192
2022-07-27T20:56:56 Deprecated: ZipArchive::open(): Using empty file as ZipArchive is deprecated in /opt/bref/breftoolbox.php on line 192
2022-07-27T20:56:56 PHP Warning: unlink(/tmp/vendor.zip): No such file or directory in /opt/bref/breftoolbox.php on line 72
2022-07-27T20:56:56 Warning: unlink(/tmp/vendor.zip): No such file or directory in /opt/bref/breftoolbox.php on line 72
2022-07-27T20:56:56 PHP Warning: file_get_contents(/tmp/vendor/composer/autoload_static.php): Failed to open stream: No such file or directory in /opt/bref/breftoolbox.php on line 216
2022-07-27T20:56:56 Warning: file_get_contents(/tmp/vendor/composer/autoload_static.php): Failed to open stream: No such file or directory in /opt/bref/breftoolbox.php on line 216
2022-07-27T20:56:56 PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, bool given in /opt/bref/breftoolbox.php:216
2022-07-27T20:56:56 Stack trace:
2022-07-27T20:56:56 #0 /opt/bref/breftoolbox.php(216): str_replace()
2022-07-27T20:56:56 #1 /opt/bref/breftoolbox.php(74): Bref\ToolBox\BrefToolBox::updateComposerAutoloading()
2022-07-27T20:56:56 #2 /opt/bref/bootstrap.php(15): Bref\ToolBox\BrefToolBox::downloadAndConfigureVendor()
2022-07-27T20:56:56 #3 {main}
2022-07-27T20:56:56 thrown in /opt/bref/breftoolbox.php on line 216
2022-07-27T20:56:56 Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, bool given in /opt/bref/breftoolbox.php:216
2022-07-27T20:56:56 Stack trace:
2022-07-27T20:56:56 #0 /opt/bref/breftoolbox.php(216): str_replace()
2022-07-27T20:56:56 #1 /opt/bref/breftoolbox.php(74): Bref\ToolBox\BrefToolBox::updateComposerAutoloading()
2022-07-27T20:56:56 #2 /opt/bref/bootstrap.php(15): Bref\ToolBox\BrefToolBox::downloadAndConfigureVendor()
2022-07-27T20:56:56 #3 {main}
2022-07-27T20:56:56 thrown in /opt/bref/breftoolbox.php on line 216
2022-07-27T20:56:56 END RequestId: 07931007-5b63-4f86-a202-bc1da684a811
2022-07-27T20:56:56 REPORT RequestId: 07931007-5b63-4f86-a202-bc1da684a811 Duration: 131239.25 ms Billed Duration: 131240 ms Memory Size: 1024 MB Max Memory Used: 32 MB
2022-07-27T20:56:56 RequestId: 07931007-5b63-4f86-a202-bc1da684a811 Error: Runtime exited with error: exit status 255
Runtime.ExitError
Also, getting this error as well.
ERROR: Uncaught Exception: Error while calling the Lambda runtime API: The requested URL returned error: 403 in /tmp/vendor/bref/bref/src/Runtime/LambdaRuntime.php:291
Stack trace:
#0 /tmp/vendor/bref/bref/src/Runtime/LambdaRuntime.php(223): Bref\Runtime\LambdaRuntime->postJson()
#1 /tmp/vendor/bref/bref/src/Runtime/LambdaRuntime.php(95): Bref\Runtime\LambdaRuntime->signalFailure()
#2 /opt/bref/bootstrap.php(43): Bref\Runtime\LambdaRuntime->processNextEvent()
#3 {main}
thrown
in /tmp/vendor/bref/bref/src/Runtime/LambdaRuntime.php:291
END RequestId: 10101995-fa97-469c-87f5-e1c6914f42d4
REPORT RequestId: 10101995-fa97-469c-87f5-e1c6914f42d4 Duration: 1090.12 ms Billed Duration: 2383 ms Memory Size: 1024 MB Max Memory Used: 172 MB Init Duration: 1292.37 ms
RequestId: 10101995-fa97-469c-87f5-e1c6914f42d4 Error: Runtime exited with error: exit status 255
Runtime.ExitError
I have the following permissions set for the lambda role. Not sure if this is related:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"sqs:DeleteMessage",
"sts:AssumeRole",
"logs:CreateLogStream",
"lambda:InvokeFunctionUrl",
"lambda:InvokeFunction",
"sqs:ReceiveMessage",
"sqs:SendMessage",
"lambda:InvokeAsync",
"sqs:GetQueueAttributes",
"logs:CreateLogGroup",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
The serverless framework deletes older deployment artifacts.
Maybe it's related? See https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#deployment-bucket
The serverless framework deletes older deployment artifacts.
Maybe it's related? See https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#deployment-bucket
I tested it with a maxPreviousDeploymentArtifacts
at 2 and the vendors
directory is not deleted (nor the zip file).
I see that the breftoolbox.php
file is using the getenv
function and, from the error log, it seems like the function is returning an empty string (or a casted null?). Can it be a problem with the fact that getenv
is not thread-safe?
@jusmark123 do you have a way to reproduce the problem from a new project?
I see that the breftoolbox.php file is using the getenv function and, from the error log, it seems like the function is returning an empty string (or a casted null?). Can it be a problem with the fact that getenv is not thread-safe?
I don't know if that's the case, but IIRC we use that function everywhere.
Ref of the latest pull request talking about this: #662
👍 sorry I meant I'm not sure if that is the source of the problem. So far we should do anything multi-threaded in Bref and apps running with Bref, but it may also be some very weird edge case ^^
Yes, it wasn't to prove my point, I'm not sure if that is the source of the problem either 😉
I'll try to reproduce the bug later or wait for a return.
Sorry this project has a quick turnaround requirement so I decided to build my own custom runtime.
Closing because the issue isn't active anymore.
Hello suddenly started getting the below errors when my Lambda function is invoked. I am using the
separateVendor
directive. It seems the only way to fix it is to redeploy the app again.My serverless is here for context, I've removed some account identifiers: Let me know if you need additional info.