mirror of https://github.com/buster-so/buster.git
more logging
This commit is contained in:
parent
3843ec3931
commit
19fe3748d2
|
@ -85,6 +85,9 @@ export class SlackAuthService {
|
|||
// Exchange code for tokens
|
||||
const tokenResponse = await this.exchangeCodeForTokens(code);
|
||||
|
||||
// Log the raw response for debugging
|
||||
console.info('Slack OAuth raw response:', JSON.stringify(tokenResponse, null, 2));
|
||||
|
||||
// Validate response
|
||||
const oauthData = validateWithSchema(
|
||||
SlackOAuthResponseSchema,
|
||||
|
@ -213,6 +216,18 @@ export class SlackAuthService {
|
|||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// Check if Slack returned an error in the response body
|
||||
const responseData = data as { ok?: boolean; error?: string; error_description?: string };
|
||||
if (responseData.ok === false || responseData.error) {
|
||||
console.error('Slack OAuth error response:', {
|
||||
ok: responseData.ok,
|
||||
error: responseData.error,
|
||||
error_description: responseData.error_description,
|
||||
fullResponse: data,
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
if (error instanceof SlackIntegrationError) {
|
||||
|
|
|
@ -17,6 +17,14 @@ export function validateWithSchema<T>(
|
|||
const result = schema.safeParse(data);
|
||||
|
||||
if (!result.success) {
|
||||
// Log detailed validation errors for debugging
|
||||
console.error('Schema validation failed:', {
|
||||
message: errorMessage,
|
||||
errors: result.error.errors,
|
||||
flattened: result.error.flatten(),
|
||||
receivedData: data,
|
||||
});
|
||||
|
||||
throw new SlackIntegrationError('UNKNOWN_ERROR', errorMessage, false, {
|
||||
zodError: result.error.flatten(),
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue