antiwork/gumroad · error · ResponseError

Something went wrong.

Error message

Something went wrong.

What it means

uploadDropboxFile() throws at line 21 when POST Routes.create_dropbox_file_path() with { ...file, link_id: permalink } returns 4xx — registering a Dropbox-hosted file on a product failed. The spread of the client-shaped DropboxFile forwards raw input to the server, where validation decides: 422 for an invalid dropbox_url/oversized file, 404 for an unknown or unpublished link_id, 403 when the caller does not own the link. A separate typia.assert on the success body at line 22 is a different failure mode.

Source

Thrown at app/javascript/data/dropbox_upload.ts:21

import { request, ResponseError } from "$app/utils/request";

export type ResponseDropboxFile = {
  external_id: string;
  name: string;
  bytes: number;
  s3_url: string | null;
  state: "in_progress" | "successfully_uploaded" | "cancelled" | "failed" | "deleted";
  dropbox_url: string;
};

export async function uploadDropboxFile(permalink: string, file: DropboxFile) {
  const response = await request({
    method: "POST",
    accept: "json",
    url: Routes.create_dropbox_file_path(),
    data: { ...file, link_id: permalink },
  });
  if (!response.ok) throw new ResponseError();
  return typia.assert<{ dropbox_file: ResponseDropboxFile }>(await response.json());
}

export async function cancelDropboxFileUpload(id: string) {
  const response = await request({
    method: "POST",
    accept: "json",
    url: Routes.cancel_dropbox_file_upload_path(id),
  });
  if (!response.ok) throw new ResponseError();
  const json = typia.assert<{ success: false } | { dropbox_file: ResponseDropboxFile; success: true }>(
    await response.json(),
  );
  if (!json.success) throw new ResponseError();
  return json.dropbox_file;
}

export async function fetchDropboxFiles(permalink: string) {

View on GitHub (pinned to afeacbd394)

Solutions

  1. Validate the URL is an https Dropbox link client-side before POSTing
  2. Refetch the product/link to confirm it still exists and is published
  3. Read the status in DevTools: 422 = payload validation, 404 = bad link_id, 403 = ownership
  4. If the request succeeds but parsing throws, that is the typia line 22 branch (response shape drift), not this one

Example fix

// before
uploadDropboxFile(permalink, file);

// after
if (!file.dropbox_url.startsWith('https://www.dropbox.com/')) {
  return toast('Paste a Dropbox share link (https://www.dropbox.com/...)');
}
await uploadDropboxFile(permalink, file);
Defensive patterns

Strategy: validation

Validate before calling

if (!/^https:\/\/www\.dropbox\.com\//.test(file.dropbox_url)) {
  throw new Error('Paste a Dropbox share link (https://www.dropbox.com/...)');
}
if (!permalink) throw new Error('Missing product permalink');

Type guard

const isResponseError = (e: unknown): e is ResponseError => e instanceof ResponseError;

Try / catch

try {
  const { dropbox_file } = await uploadDropboxFile(permalink, file);
  addFile(dropbox_file);
} catch (e) {
  assertResponseError(e);
  if (e instanceof RateLimitError) return showRetryLater(e.retryAfter);
  toast('Could not add the file. Check the Dropbox link and that the product still exists.');
}

Prevention

When it happens

Trigger: dropbox_url not a valid Dropbox share link (422); file bytes/name over the endpoint's limits (422); link_id for a deleted or unpublished product (404); session not the link owner (403); CSRF (401).

Common situations: Users pasting Google Drive or plain URLs into the Dropbox field; product deleted while the uploader panel was open; deploys changing upload limits so previously-fine files now 422.

Related errors


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