antiwork/gumroad · error · ResponseError

Something went wrong.

Error message

Something went wrong.

What it means

ResponseError ('Something went wrong.') thrown at product_reviews.ts:79 when the GET to Routes.product_reviews_path({ product_id, page }) returns non-ok — a 4xx, since 5xx/429/network are converted inside request(). This lists a product's reviews with pagination; the failure means the endpoint rejected the product/page combination, and the generic message hides which.

Source

Thrown at app/javascript/data/product_reviews.ts:79

  created_at: string;
  is_new: boolean;
  response: {
    message: string;
  } | null;
  video: {
    id: string;
    thumbnail_url: string | null;
  } | null;
};

export const getReviews = async (productId: string, page: number) => {
  const response = await request({
    method: "GET",
    url: Routes.product_reviews_path({ product_id: productId, page }),
    accept: "json",
  });

  if (!response.ok) throw new ResponseError();

  return typia.assert<{ reviews: Review[]; pagination: PaginationProps }>(await response.json());
};

export const getReview = async (reviewId: string): Promise<{ review: Review }> => {
  const response = await request({
    method: "GET",
    url: Routes.product_review_path(reviewId),
    accept: "json",
  });

  if (!response.ok) throw new ResponseError();

  return typia.assert<{ review: Review }>(await response.json());
};

export const getStreamingUrls = async (id: string) => {
  const response = await request({

View on GitHub (pinned to afeacbd394)

Solutions

  1. Check the GET status in DevTools: 404 → bad product id, other 4xx → page/session
  2. Clamp/normalize page to a positive integer before calling (see validationCode)
  3. Source productId from the loaded page data, not from window.location or a loosely parsed query param
  4. If 404 recurs for an existing product, confirm the route helper receives the identifier the controller expects (id vs permalink)
  5. Treat a failed reviews fetch as non-fatal: render the product page without reviews rather than erroring the whole page

Example fix

// before
export const getReviews = async (productId: string, page: number) => {
  const response = await request({ method: 'GET', url: Routes.product_reviews_path({ product_id: productId, page }), accept: 'json' });
  if (!response.ok) throw new ResponseError();
  // ...
};

// after
if (!response.ok) {
  const body = await response.json().catch(() => null) as { error?: string } | null;
  throw new ResponseError(body?.error ?? `Failed to load reviews (${response.status})`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const validReviewQuery = (productId: string, page: number): boolean =>
  productId.length > 0 && Number.isInteger(page) && page >= 1;

Type guard

import { assertResponseError } from '$app/utils/request';
assertResponseError(e);

Try / catch

try {
  return await getReviews(productId, page);
} catch (e) {
  assertResponseError(e);
  return { reviews: [], pagination: emptyPagination }; // reviews are supplementary — degrade, don't block
}

Prevention

When it happens

Trigger: 404 when productId doesn't resolve to a product (typo, deleted, unpublished — reviews of unpublished products are not public); 422/400 when page is malformed (0, negative, non-numeric from a bad URL param); 401/403 when the endpoint demands a session (e.g., for a non-public product) and the visitor is anonymous.

Common situations: Reviews component on a stale product page after the seller unpublished; pagination links built from scraped or malformed URLs feeding garbage page values; product id passed where the route expects the product's permalink, mismatching after an identifier scheme change; crawlers walking ?page=999999999 hitting server-side page guards.

Related errors


AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21). Data as JSON: /api/errors/1ab5f646c539c86f. Report an issue: GitHub.