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

Can I fire putJobSuccessResult event from AWS Lambda which is developed with Bref? #1781

Closed
tentree-development opened this issue Apr 9, 2024 · 1 comment
Labels

Comments

@tentree-development
Copy link

I am setting up aws codepipeline and need to fire putJobSuccessFresult so pipeline can finish the deployment task.
Currently I can't call this event so it hangs and times out eventually. Here is the error message I am getting. From my understanding I won't be able to push my code using codepipeline?

"errorType": "Bref\Event\InvalidLambdaEvent",
"errorMessage": "This handler expected to be invoked with a API Gateway or ALB event. Instead, the handler was invoked with invalid event data: Array\n(\n [CodePipeline.job] => Array\n (\n
"#0 /var/task/vendor/bref/bref/src/Event/Http/HttpHandler.php(23): Bref\Event\Http\HttpRequestEvent->__construct()",
"#1 /var/task/vendor/bref/bref/src/Runtime/Invoker.php(29): Bref\Event\Http\HttpHandler->handle()",
"#2 /var/task/vendor/bref/bref/src/Runtime/LambdaRuntime.php(91): Bref\Runtime\Invoker->invoke()",
"#3 /opt/bootstrap(43): Bref\Runtime\LambdaRuntime->processNextEvent()",
"#4 {main}`

=========serverless.yml=========
service: app

provider:
name: aws
region: us-west-2

plugins:
- ./vendor/bref/bref

functions:
api:
handler: public/index.php
description: ''
runtime: php-83-fpm
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
events:
- httpApi: '*'

Exclude files from deployment

package:
patterns:
- '!node_modules/'
- '!tests/
'

=========index.php=========

addRoutingMiddleware(); /** * Add Error Middleware * * @param bool $displayErrorDetails -> Should be set to false in production * @param bool $logErrors -> Parameter is passed to the default ErrorHandler * @param bool $logErrorDetails -> Display error details in error log * @param LoggerInterface|null $logger -> Optional PSR-3 Logger * * Note: This middleware should be added last. It will not handle any exceptions/errors * for middleware added after it. */ $errorMiddleware = $app->addErrorMiddleware(true, true, true); // Define app routes $app->get('/', function (Request $request, Response $response, $args) { $response->getBody()->write("Welcome to the location serverless app!"); return $response; }); $app->get('/phpinfo', function (Request $request, Response $response, $args) { phpinfo(); }); return function ($event) { return 'Hello ' . ($event['name'] ?? 'world'); }; // Run app $app->run();
@mnapoli
Copy link
Member

mnapoli commented Apr 10, 2024

How is this a bug? Can you open a support discussion instead?

@mnapoli mnapoli closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants