Skip to content

Invalid Github API token causes webhook to fail silently #380

@dregad

Description

@dregad

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions