toeverything/AFFiNE · error

Failed to fetch oEmbed data

Error message

Failed to fetch oEmbed data: ${response.status} ${response.statusText}

What it means

Warning logged in EmbedIframeService when the oEmbed endpoint responds with a non-ok HTTP status (e.g. 404 or 403 for the provider's oEmbed URL). Returns null so no iframe embed is produced; the faulting input is the provider oEmbed request that the remote service refused or could not serve.

Solutions

  1. Check the oEmbed endpoint status and retry.
  2. Verify the provider URL is supported and reachable.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Triggered when the oEmbed endpoint responds with a non-OK HTTP status while the embed iframe service fetches embed metadata, returning null data.

Common situations: Occurs when embedding a link whose provider's oEmbed API is down, rate-limited, or rejects the URL. Retry later or verify the link is publicly accessible.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/f7b9ff2e5a687dce. Report an issue: GitHub.

Appendix: source

Thrown at blocksuite/affine/shared/src/services/embed-iframe/embed-iframe-service.ts:124

      }

      const oEmbedUrl = config.buildOEmbedUrl(url);

      if (!oEmbedUrl) {
        return null;
      }

      // if the config useOEmbedUrlDirectly is true, return the url directly as iframe_url
      if (config.useOEmbedUrlDirectly) {
        return {
          iframe_url: oEmbedUrl,
        };
      }

      // otherwise, fetch the oEmbed data
      const response = await fetch(oEmbedUrl, { signal });
      if (!response.ok) {
        console.warn(
          `Failed to fetch oEmbed data: ${response.status} ${response.statusText}`
        );
        return null;
      }

      const data = await response.json();
      return data as EmbedIframeData;
    } catch (error) {
      if (error instanceof Error && error.name !== 'AbortError') {
        console.error('Error fetching embed iframe data:', error);
      }
      return null;
    }
  };

  addEmbedIframeBlock = (
    props: Partial<EmbedIframeBlockProps>,
    parentId: string,

View on GitHub (pinned to b4c8548c09)