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

Prevent crash if key attribute is missing #159

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

DocLM
Copy link
Contributor

@DocLM DocLM commented Aug 27, 2024

Hi, I've a set of Lambda that use Bref and Laravel 11.
After updating to 2.4.0 Lambdas started to crash with the following stack trace:

development.ERROR: Undefined array key "key" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"key\" at /var/task/vendor/bref/laravel-bridge/src/BrefServiceProvider.php:165)
[stacktrace]
#0 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'Undefined array...', '/var/task/vendo...', 165)
#1 /var/task/vendor/bref/laravel-bridge/src/BrefServiceProvider.php(165): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'Undefined array...', '/var/task/vendo...', 165)
#2 /var/task/vendor/bref/laravel-bridge/src/BrefServiceProvider.php(50): Bref\\LaravelBridge\\BrefServiceProvider->fixAwsCredentialsConfig()
#3 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(868): Bref\\LaravelBridge\\BrefServiceProvider->register()
#4 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register(Object(Bref\\LaravelBridge\\BrefServiceProvider))
#5 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(843): Illuminate\\Foundation\\ProviderRepository->load(Array)
#6 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(37): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#7 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(316): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#8 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(473): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#9 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(195): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#10 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1203): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#11 /var/task/artisan(13): Illuminate\\Foundation\\Application->handleCommand(Object(Symfony\\Component\\Console\\Input\\ArgvInput))
#12 {main}

I've added an additional guard against key attribute in order to prevent crashes when it is missing.

Environment:

  • PHP: 8.3
  • Bref: 2.3.4
  • Laravel Bridge: 2.4.0

@mnapoli
Copy link
Member

mnapoli commented Aug 27, 2024

Thank you very much!

@mnapoli mnapoli merged commit d97d1bc into brefphp:master Aug 27, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants