question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@vercel/og : Unknown file extension ".wasm" for node_modules/@vercel/og/vendor/resvg.simd.wasm

See original GitHub issue

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #59-Ubuntu SMP Fri Sep 9 09:37:59 UTC 2022
Binaries:
  Node: 16.14.0
  npm: 8.3.1
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 13.0.1-canary.0
  eslint-config-next: 13.0.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next build (to test in local) / Vercel + github

Describe the Bug

When I build and/or deploy my website sur Vercel (build well no problem), and then I go to mywebsite.com/api/og, I have the following Error:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".wasm" for /path/website/node_modules/@vercel/og/vendor/resvg.simd.wasm
    at new NodeError (node:internal/errors:371:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
    at defaultLoad (node:internal/modules/esm/load:21:14)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

./api/og.jsx:

import { ImageResponse } from "@vercel/og";

const font = fetch(
  new URL("../../assets/fonts/SourceSansPro-SemiBold.ttf", import.meta.url)
).then((res) => res.arrayBuffer());

export default async function () {
  const fontData = await font;

  return new ImageResponse(
    (
      <div
        style={{
          height: "100%",
          width: "100%",
          display: "flex",
          flexDirection: "column",
          alignItems: "center",
          justifyContent: "center",
          fontFamily: '"SourceSansPro"',
          backgroundImage:
            "radial-gradient(circle, rgb(79,70,229) 0%, rgb(49, 46, 129) 100%)",
        }}
      >
          test
      </div>
    ),
    {
      width: 1200,
      height: 630,
      fonts: [
        {
          name: "SourceSansPro",
          data: fontData,
          style: "normal",
        },
      ],
    }
  );
}

Expected Behavior

I can see the OG card like I do during development: it’s working when I use next dev

Link to reproduction

https://github.com/Thisisjuke/nextjs-og-next13-bug-reproduction

To Reproduce

  • yarn
  • yarn dev
  • Go to localhost:3000/api/og : you can see the OG card or have the error
  • yarn build
  • yarn start
  • Go to localhost:3000/api/og : you should have an error

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
balazsorban44commented, Oct 27, 2022

Hi, you are missing the runtime config:

export const config = {
  runtime: "experimental-edge"
}
0reactions
DuCanhGHcommented, Dec 20, 2022

@Thisisjuke it is actually #43326 but cheers 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown file extension "" for D:\Projects\matri-site\bin\www for ...
I was using es6 syntax and type module having JS extension files. But, when I upgraded to Node 14.1.0. It's showing the following...
Read more >
Roadmap - WebAssembly
Your browser Firefox JS BigInt to Wasm i64 integration ✓ Supported 78. ✓ Supported since version 78 Bulk memory operations ✓ Supported 79. ✓ Supported...
Read more >
Understanding WebAssembly text format - MDN Web Docs
To enable WebAssembly to be read and edited by humans, there is a textual representation of the wasm binary format. This is an...
Read more >
Fast, parallel applications with WebAssembly SIMD · V8
The current proposal introduces a new v128 value type, and a number of new operations that operate on this type. The criteria used...
Read more >
Node.js with WebAssembly
wat extension. Key Concepts. Module - A compiled WebAssembly binary, ie a .wasm file. Memory - A resizable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found