source-integration icon indicating copy to clipboard operation
source-integration copied to clipboard

Invalid Github API token causes webhook to fail silently

Open dregad opened this issue 3 years ago • 2 comments

The Webhook delivery results in an HTTP 200 return code, but the response is actually a MantisBT error page: INTERNAL APPLICATION ERROR

Delivering the payload with $g_show_detailed_errors = ON; yields additional information

Client error: `GET https://api.github.com/rate_limit?per_page=100` resulted in a `401 Unauthorized` response:
{
"message": "Bad credentials",
"documentation_url": "https://docs.github.com/rest"
}

Stack trace

0	.../vendor/guzzlehttp/guzzle/src/Middleware.php	65	GuzzleHttp\Exception\RequestException	::	create	-
1	.../vendor/guzzlehttp/promises/src/Promise.php	204	GuzzleHttp\Middleware	::	GuzzleHttp\{closure}	-
2	.../vendor/guzzlehttp/promises/src/Promise.php	153	GuzzleHttp\Promise\Promise	::	callHandler	-
3	.../vendor/guzzlehttp/promises/src/TaskQueue.php	48	GuzzleHttp\Promise\Promise	::	GuzzleHttp\Promise\{closure}	-
4	.../vendor/guzzlehttp/promises/src/Promise.php	248	GuzzleHttp\Promise\TaskQueue	->	run	-
5	.../vendor/guzzlehttp/promises/src/Promise.php	224	GuzzleHttp\Promise\Promise	->	invokeWaitFn	-
6	.../vendor/guzzlehttp/promises/src/Promise.php	269	GuzzleHttp\Promise\Promise	->	waitIfPending	-
7	.../vendor/guzzlehttp/promises/src/Promise.php	226	GuzzleHttp\Promise\Promise	->	invokeWaitList	-
8	.../vendor/guzzlehttp/promises/src/Promise.php	62	GuzzleHttp\Promise\Promise	->	waitIfPending	-
9	.../vendor/guzzlehttp/guzzle/src/Client.php	182	GuzzleHttp\Promise\Promise	->	wait	-
10	.../vendor/guzzlehttp/guzzle/src/Client.php	95	GuzzleHttp\Client	->	request	-
11	.../plugins/SourceGithub/SourceGithub.php	506	GuzzleHttp\Client	->	__call	-
12	.../plugins/SourceGithub/SourceGithub.php	546	SourceGithubPlugin	->	api_get	-
13	.../plugins/SourceGithub/SourceGithub.php	720	SourceGithubPlugin	->	api_json_url	-
14	.../plugins/SourceGithub/SourceGithub.php	639	SourceGithubPlugin	->	import_commits	-
15	.../plugins/Source/Source.API.php	524	SourceGithubPlugin	->	commit	-
16	.../plugins/source-integration/Source/pages/checkin.php	86	SourceVCSWrapper	->	__call	-
17	.../plugin.php	74	-	-	include	<string>'/srv/plugins/source-integration/Source/pages/checkin.php'

The Guzzle RequestException should be caught and reported as a meaningful error.

dregad avatar Dec 24 '21 12:12 dregad

Same root cause as #266

dregad avatar Dec 30 '21 11:12 dregad