slymnoyann/hey-1 · error · Error

Something went wrong!

Error message

Something went wrong!

What it means

Thrown by uploadMetadata when storageClient.uploadAsJson rejects or throws for any reason; the original error is swallowed and replaced with a generic SomethingWentWrong. This wraps metadata JSON uploads (e.g. NFT/app metadata) to IPFS storage with an ACL tied to the chain id.

Source

Thrown at src/helpers/uploadMetadata.ts:20

import { CHAIN } from "@/data/constants";
import { ERRORS } from "@/data/errors";
import { storageClient } from "./storageClient";

interface MetadataPayload {
  [key: string]: unknown;
}

const uploadMetadata = async (
  data: MetadataPayload | null
): Promise<string> => {
  try {
    const { uri } = await storageClient.uploadAsJson(data, {
      acl: immutable(CHAIN.id)
    });

    return uri;
  } catch {
    throw new Error(ERRORS.SomethingWentWrong);
  }
};

export default uploadMetadata;

View on GitHub (pinned to 88c8f9d553)

Solutions

  1. Inspect the original caught error (log it before rethrowing) to identify the real cause
  2. Verify storage client credentials and endpoint configuration against .env.example
  3. Confirm CHAIN.id and the immutable() acl helper produce values the storage service accepts
  4. Add retry with backoff for transient storage service failures instead of immediately surfacing the generic error

Example fix

// before
} catch {
  throw new Error(ERRORS.SomethingWentWrong);
}

// after
} catch (e) {
  console.error("uploadMetadata failed:", e);
  throw new Error(ERRORS.SomethingWentWrong);
}
Defensive patterns

Strategy: fallback

Validate before calling

if (data == null || typeof data !== "object") {
  throw new Error("Invalid metadata payload");
}
try { JSON.stringify(data); } catch {
  throw new Error("Metadata is not JSON-serializable");
}

Type guard

const isSerializable = (d: unknown): d is Record<string, unknown> =>
  typeof d === "object" && d !== null && (() => { try { JSON.stringify(d); return true; } catch { return false; } })();

Try / catch

try {
  const uri = await uploadMetadata(data);
} catch (e) {
  if (e instanceof Error && e.message === "Something went wrong!") {
    // retry once with backoff, then surface a specific message
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling uploadMetadata when the storage client is misconfigured (wrong endpoint/keys), the JSON payload is not serializable, the storage service rate-limits or returns 5xx, or the acl/immutable(CHAIN.id) argument is invalid for the configured chain.

Common situations: Missing or expired storage service API keys in env, incorrect CHAIN.id after a chain config change, rate limiting during bulk metadata uploads, or a storage SDK version whose uploadAsJson signature changed so options are rejected.

Related errors


AI-assisted analysis of slymnoyann/hey-1@88c8f9d553 (2026-08-28). Data as JSON: /api/errors/1380b34a39672f4c. Report an issue: GitHub.