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

Credentials for DynamoDB from Lambda are not getting created properly #2805

Closed
anuragnandan opened this issue Oct 27, 2023 · 4 comments
Closed
Assignees
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@anuragnandan
Copy link

Describe the bug

Laravel application with DynamoDB as cache and session driver fails to connect due to credentials missing. I've been using the same config as before for v3.258 and started failing when updated to v3.281.12

Error: Credentials must be an instance of 'Aws\Credentials\CredentialsInterface, an associative array that contains "key", "secret", and an optional "token" key-value pairs, a credentials provider function, or false.Array

The same app works on EC2 with role that has same permissions as the Lambda role.

Expected Behavior

Load the app by opening connection to DynamoDB for session and cache storage

Current Behavior

Laravel App with bref/bref that enables the app to run on lambda as a function, started failing when aws-sdk-php package was updated to 3.281.12 with error related to credentials

Error: Credentials must be an instance of 'Aws\Credentials\CredentialsInterface, an associative array that contains "key", "secret", and an optional "token" key-value pairs, a credentials provider function, or false.Array

Upon adding more debug logs to the library when it creates AWS Client, I see that there's only token being generated in the credentials and not key or secret being passed.

Screenshot 2023-10-27 at 11 23 11 AM

Reproduction Steps

Load Laravel app with Bref on a Lambda function and dynamodb as cache or session driver

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.281.12

Environment details (Version of PHP (php -v)? OS name and version, etc.)

php 8.2 with arn:aws:lambda:us-east-2:534081306603:layer:php-82-fpm:48 layer

@anuragnandan anuragnandan added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 27, 2023
@anuragnandan
Copy link
Author

StackTrace :

"
1698244252782,"[stacktrace]
"
1698244252782,"#0 /var/task/vendor/aws/aws-sdk-php/src/ClientResolver.php(388): Aws\\ClientResolver::_apply_credentials(Array, Array, Object(Aws\\HandlerList))
"
1698244252782,"#1 /var/task/vendor/aws/aws-sdk-php/src/AwsClient.php(222): Aws\\ClientResolver->resolve(Array, Object(Aws\\HandlerList))
"
1698244252782,"#2 /var/task/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(271): Aws\\AwsClient->__construct(Array)
"
1698244252782,"#3 /var/task/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(234): Illuminate\\Cache\\CacheManager->newDynamodbClient(Array)
"
1698244252782,"#4 /var/task/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(98): Illuminate\\Cache\\CacheManager->createDynamodbDriver(Array)
"
1698244252782,"#5 /var/task/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(61): Illuminate\\Cache\\CacheManager->resolve('dynamodb')
"
1698244252782,"#6 /var/task/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(179): Illuminate\\Cache\\CacheManager->store('dynamodb')
"
1698244252782,"#7 /var/task/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(165): Illuminate\\Session\\SessionManager->createCacheHandler('dynamodb')
"
1698244252782,"#8 /var/task/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php(154): Illuminate\\Session\\SessionManager->createCacheBased('dynamodb')
"
1698244252782,"#9 /var/task/vendor/laravel/framework/src/Illuminate/Support/Manager.php(106): Illuminate\\Session\\SessionManager->createDynamodbDriver()
"
1698244252782,"#10 /var/task/vendor/laravel/framework/src/Illuminate/Support/Manager.php(80): Illuminate\\Support\\Manager->createDriver('dynamodb')
"
1698244252782,"#11 /var/task/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php(52): Illuminate\\Support\\Manager->driver()
"
1698244252782,"#12 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Session\\SessionServiceProvider->Illuminate\\Session\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
"
1698244252782,"#13 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
"
1698244252782,"#14 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve('session.store', Array, true)
"
1698244252782,"#15 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve('session.store', Array)
"
1698244252782,"#16 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make('session.store', Array)
"
1698244252782,"#17 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make('session.store')
"
1698244252782,"#18 /var/task/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(120): Illuminate\\Container\\Container->offsetGet('session.store')
"
1698244252782,"#19 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Routing\\RoutingServiceProvider->Illuminate\\Routing\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
"
1698244252782,"#20 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
"
1698244252782,"#21 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve('redirect', Array, true)
"
1698244252782,"#22 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve('redirect', Array)
"
1698244252782,"#23 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make('redirect', Array)
"
1698244252782,"#24 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make('redirect')
"
1698244252782,"#25 /var/task/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(174): Illuminate\\Container\\Container->offsetGet('redirect')
"
1698244252782,"#26 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Routing\\RoutingServiceProvider->Illuminate\\Routing\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
"
1698244252782,"#27 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
"
1698244252782,"#28 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve('Illuminate\\\\Cont...', Array, true)
"
1698244252782,"#29 /var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve('Illuminate\\\\Cont...', Array)
"
1698244252782,"#30 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make('Illuminate\\\\Cont...', Array)
"
1698244252782,"#31 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(120): Illuminate\\Foundation\\Application->make('Illuminate\\\\Cont...', Array)
"
1698244252782,"#32 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(790): app('Illuminate\\\\Cont...')
"
1698244252782,"#33 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(681): response()
"
1698244252782,"#34 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(609): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException(Object(Symfony\\Component\\HttpKernel\\Exception\\HttpException))
"
1698244252782,"#35 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(515): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse(Object(Illuminate\\Http\\Request), Object(Symfony\\Component\\HttpKernel\\Exception\\HttpException))
"
1698244252782,"#36 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(432): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse(Object(Illuminate\\Http\\Request), Object(InvalidArgumentException))
"
1698244252782,"#37 /var/task/app/Exceptions/Handler.php(86): Illuminate\\Foundation\\Exceptions\\Handler->render(Object(Illuminate\\Http\\Request), Object(InvalidArgumentException))
"
1698244252782,"#38 /var/task/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(51): App\\Exceptions\\Handler->render(Object(Illuminate\\Http\\Request), Object(InvalidArgumentException))
"
1698244252782,"#39 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(185): Illuminate\\Routing\\Pipeline->handleException(Object(Illuminate\\Http\\Request), Object(InvalidArgumentException))
"
1698244252782,"#40 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
"
1698244252782,"#41 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
"
1698244252782,"#42 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
"
1698244252782,"#43 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
"
1698244252782,"#44 /var/task/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
"
1698244252782,"#45 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
"
1698244252782,"#46 /var/task/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
"
1698244252782,"#47 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
"
1698244252782,"#48 /var/task/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
"
1698244252782,"#49 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
"
1698244252782,"#50 /var/task/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
"
1698244252782,"#51 /var/task/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
"
1698244252782,"#52 {main}
"

@stobrien89
Copy link
Member

stobrien89 commented Oct 27, 2023

Hi @anuragnandan,

Sorry to hear about the issues. I think this might be related to laravel/framework#44979. token has never been a valid top-level config option in V3 and Laravel had to make changes to how they handle our config when we introduced a new bearer-token authentication method.

@stobrien89 stobrien89 added guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 27, 2023
@stobrien89 stobrien89 self-assigned this Oct 27, 2023
@anuragnandan
Copy link
Author

It seems to be because of this change on laravel framework.

Copy link

github-actions bot commented Nov 1, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants