antiwork/gumroad · error · ResponseError
Something went wrong.
Error message
Something went wrong.
What it means
Thrown after the Google Calendar OAuth handshake: the callback page has a ?code= param and this GET to account_info_integrations_google_calendar_index_path({ code }) asks the server to exchange that code for access/refresh tokens. typia.assert narrows the reply to a success:true token set or { success: false }; on success:false a bare ResponseError('Something went wrong.') is thrown. The endpoint returns no reason, so diagnosis has to happen server-side.
Source
Thrown at app/javascript/data/google_calendar_integration.ts:23
type AccountInfo = { accessToken: string; refreshToken: string; email: string };
type Calendar = { id: string; summary: string };
export const fetchAccountInfo = async (code: string): Promise<AccountInfo> => {
const response = await request({
method: "GET",
url: Routes.account_info_integrations_google_calendar_index_path({ format: "json", code }),
accept: "json",
});
const responseData = typia.assert<
| {
success: true;
access_token: string;
refresh_token: string;
email: string;
}
| { success: false }
>(await response.json());
if (!responseData.success) throw new ResponseError();
return {
accessToken: responseData.access_token,
refreshToken: responseData.refresh_token,
email: responseData.email,
};
};
export const fetchCalendarList = async (accessToken: string, refreshToken: string): Promise<Calendar[]> => {
const response = await request({
method: "GET",
url: Routes.calendar_list_integrations_google_calendar_index_path({
format: "json",
access_token: accessToken,
refresh_token: refreshToken,
}),
accept: "json",
});
const responseData = typia.assert<View on GitHub (pinned to afeacbd394)
Solutions
- Do not re-submit a used code — restart the flow with getOAuthUrl() to mint a fresh authorization code.
- Check the server logs for the Google token-exchange response; the client gets no reason in the JSON.
- Verify the Google OAuth client's redirect URIs and client ID/secret for this environment.
- Guard the callback route so a repeat visit (refresh/back button) re-initiates OAuth instead of replaying the code.
Example fix
// before
if (!responseData.success) throw new ResponseError();
// after — at minimum log the failure server-side so the client message is not the only clue
if (!responseData.success) throw new ResponseError("We couldn't connect Google Calendar. Please try connecting again."); Defensive patterns
Strategy: fallback
Type guard
const isExchangeFailure = (json: unknown): json is { success: false } =>
typeof json === 'object' && json !== null && (json as { success?: unknown }).success === false; Try / catch
try {
const tokens = await getAccessToken(code);
} catch (e) {
assertResponseError(e);
renderReconnectUI(); // fallback: offer a fresh OAuth round-trip, since the code is single-use
} Prevention
- Never replay an OAuth code — one exchange per code, ever.
- Handle the callback so refresh/back navigation restarts the flow instead of resubmitting.
- Keep redirect URIs and client credentials identical across environments.
- Preserve server-side logs of the Google token-exchange response; the client payload has no reason.
When it happens
Trigger: Authorization code invalid, expired (roughly 10-minute lifetime), or already redeemed (a page refresh re-submits the same code); redirect_uri mismatch between the Google OAuth client config and the request; wrong or missing client ID/secret env vars on the server; the user denied consent.
Common situations: A developer reloads the callback URL during testing and the one-time code is consumed twice; OAuth client credentials differ between staging and production; a Google-side incident rejects the token exchange.
Related errors
- Something went wrong.
- ${responseData.error}
- typia.assert<{ error: string }>(json).error
- typia.assert<{ message: string }>(await response.json()).mes
- responseData.error_message
AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21).
Data as JSON: /api/errors/dbd27cbaf9844ac0.
Report an issue: GitHub.