AssumeRoleCredentialProvider replaces non-RuntimeException failures with TypeError
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- aws, php
- Área
- authentication, cloud
Línea de trabajo
The fault is in the rejection callback of AssumeRoleCredentialProvider::__invoke(), which type-hints RuntimeException. Run the reproduction script from the issue to see the TypeError. Done means Throwable is accepted, RuntimeException keeps its current handling, and other failures are rethrown unchanged with getPrevious() intact. Pull request #3372 already targets this, so check it before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When an STS request throws an exception that doesn’t extend RuntimeException, AssumeRoleCredentialProvider replaces it with a TypeError and loses the original exception.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
I think other exceptions should pass through unchanged instead of being replaced with a type error.
Current Behavior
The example below fails with:
Argument #1 ($exception) must be of type RuntimeException, Exception given
The original exception is also lost: getPrevious() returns null.
Reproduction Steps
This example reproduces it without making any network requests or needing an AWS account.
Install aws/aws-sdk-php version 3.399.2, then run:
<?php
require 'vendor/autoload.php';
$client = new Aws\Sts\StsClient([
'region' => 'us-east-1',
'version' => '2011-06-15',
'credentials' => ['key' => 'test', 'secret' => 'test'],
'http_handler' => function () {
throw new Exception('Request cancelled');
},
]);
$provider = new Aws\Credentials\AssumeRoleCredentialProvider([
'client' => $client,
'assume_role_params' => [
'RoleArn' => 'arn:aws:iam::123456789012:role/test',
'RoleSessionName' => 'test',
],
]);
$provider()->wait();
Possible Solution
The rejection callback in AssumeRoleCredentialProvider::__invoke() only accepts RuntimeException. It could accept Throwable, keep the existing handling for RuntimeException, and rethrow other failures unchanged.
Additional Information/Context
The same callback is still present on master.
SDK version used
3.399.2
Environment details (Version of PHP (php -v)? OS name and version, etc.)
PHP 8.4.25, Ubuntu 24.04.
Generated by Codex, and reviewed by @binaryfire.
- Lenguaje dominante
- PHP
- Estrellas
- 6.2k
- Forks
- 1.3k
- Merge medio
- 2 d 7 h
- PR fusionados (30 d)
- 11
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-sdk-php
-
feature-request needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aws/aws-sdk-php#3365 ·
Los mantenedores suelen responder en 2 días
-
Event stream decoder drops the final event when reading it reaches EOFPosiblemente ocupada @lazerg la tomó hace 1 día. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 62/100
aws/aws-sdk-php#3374 ·
Los mantenedores suelen responder en 2 días
-
Event stream decoder reports a checksum mismatch when the checksum is read in partsPosiblemente ocupada @lazerg la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
aws/aws-sdk-php#3371 ·
Los mantenedores suelen responder en 2 días
-
announcement
Dificultad 4/5 3-5 días Aptitud para principiantes 12/100
aws/aws-sdk-php#3369 ·
Los mantenedores suelen responder en 2 días
-
bug needs-triage
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
aws/aws-sdk-php#3364 ·
Los mantenedores suelen responder en 2 días
Todos los issues de aws/aws-sdk-php
Issues similares
-
sync-en
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 4 días
-
Перевод устарел
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
-
feature request
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
home php
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
vincent-peugnet/wcms#670 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
freescout-help-desk/freescout#5731 · 1 comentario ·
Los mantenedores suelen responder en 1 día