Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open graph image. SVG data parsing failed cause unknown token at 1:1 #61047

Open
rusakovic opened this issue Jan 23, 2024 · 25 comments
Open

Open graph image. SVG data parsing failed cause unknown token at 1:1 #61047

rusakovic opened this issue Jan 23, 2024 · 25 comments
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization. Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@rusakovic
Copy link

rusakovic commented Jan 23, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/amazing-easley-s8cw85?file=%2Fapp%2F%5Bslug%5D%2Fopengraph-image.tsx%3A48%2C18

To Reproduce

  1. Self-hosted NGINX server
  2. Cloudflare CDN
  3. Build app
  4. Upload to self host
  5. Open Dynamic opengraph-image.tsx
/* eslint-disable @next/next/no-img-element */
import supabase from "@/supabase/supabase";
import { ImageResponse } from "next/og";


export const runtime = "edge";

export const dynamic = "force-dynamic"; // Sure, should work without this!!! Temp solution

const LOGO = 'https://site.com/logo.png'

// Image metadata
export const alt = "Alt text";

export const size = {
  width: 1200,
  height: 630,
};

export const contentType = "image/png";

// Image generation
export default async function Image({ params: { slug } }:) {
  try {
    const { data } = await supabase
      .from("table")
      .select(id)
      .match({ slug })
      .single();

    if (!data) {
      return {
        title: "Titl",
      };
    }


    return new ImageResponse(
      (
        // ImageResponse JSX element
        <div
          style={{
            fontFamily: "Inter",
            display: "flex",
            alignItems: "center",
            flexDirection: "column",
            height: "100%",
            width: "100%",
            paddingLeft: "5%",
            paddingRight: "5%",
            background: "linear-gradient(to top right, #F9FAFB, #FFEDD5)",
          }}
        >
          <div
            style={{
              display: "flex",
              height: "20%",
              alignSelf: "flex-start",
              alignItems: "center",
            }}
          >
            <img
              // @ts-ignore because no other instructions https://vercel.com/docs/functions/edge-functions/og-image-generation/og-image-examples#using-a-local-image
              src={LOGO}
              alt="logo"
              style={{
                width: "50px",
                height: "50px",
                objectFit: "cover",
              }}
            />
        </div>
      ),
      // ImageResponse options
      {
        // For convenience, we can re-use the exported opengraph-image
        // size config to also set the ImageResponse's width and height.
        ...size,
        // @ts-ignore
        // fonts: await getFonts(),
      }
    );
  } catch (error) {
    console.error("Failed to fetch logo", error);
    // Handle error or return a default image
  }
}

Current vs. Expected behavior

On the first load of /open-graph the image is generated.
But on cached version I got the error

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async sendResponse (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/send-response.js:40:13)
    at async doRender (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1363:25)
    at async cacheEntry.responseCache.get.routeKind (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1555:28)
    at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1463:28)
    at async NextNodeServer.renderPageComponent (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1856:24)
    at async NextNodeServer.renderToResponseImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1894:32)
    at async NextNodeServer.pipeImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:911:25)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:271:17) {
  [cause]: Error: SVG data parsing failed cause unknown token at 1:1
      at imports.wbg.__wbg_new_15d3966e9981a196 (file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:18465:17)
      at wasm://wasm/005420d6:wasm-function[515]:0x112c4c
      at wasm://wasm/005420d6:wasm-function[30]:0x3ffde
      at new Resvg (file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:18347:12)
      at new Resvg2 (file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:18563:5)
      at render (file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:18783:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.start (file:///app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:19006:25)
}

with export const dynamic = "force-dynamic"; I receive the similar error.

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NextNodeServer.runEdgeFunction (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:1225:13)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:247:37)
    at async NextNodeServer.handleRequestImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:807:17)
    at async invokeRender (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:163:21)
    at async handleRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:342:24)
    at async requestHandlerImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:366:13)
    at async Server.requestListener (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:140:13) {
  [cause]: Error: SVG data parsing failed cause unknown token at 1:1
      at e.wbg.__wbg_new_15d3966e9981a196 (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:59785)
      at wasm://wasm/005420d6:wasm-function[515]:0x112c4c
      at wasm://wasm/005420d6:wasm-function[30]:0x3ffde
      at new a7 (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:57743)
      at new si (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:61382)
      at sp (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:65344)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.start (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:68482)
}

Update 25.01. I get this error now

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NextNodeServer.runEdgeFunction (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:1225:13)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:247:37)
    at async NextNodeServer.handleRequestImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:807:17)
    at async invokeRender (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:163:21)
    at async handleRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:342:24)
    at async requestHandlerImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:366:13)
    at async Server.requestListener (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:140:13) {
  [cause]: RuntimeError: memory access out of bounds
      at wasm://wasm/005420d6:wasm-function[30]:0x3d9f3
      at new a7 (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:57743)
      at new si (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:61382)
      at sp (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:65344)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.start (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:68482)
}

Live check (could work when you open, because I use force-dynamic to check if it helps)
https://likeremote.com/remote-jobs/stripe-remote-job-staff-developer-advocate-developer-relations-7778/opengraph-image

The error from Cloudlfare side, just 502 error, for sure
image

Now I use export const dynamic = "force-dynamic"; not to generate cache version.

Expected: The cached open graph image showed correctly

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 8.10.5
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.0.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Dynamic imports (next/dynamic), Image optimization (next/image, next/legacy/image), Middleware / Edge (API routes, runtime)

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

No response

@rusakovic rusakovic added the bug Issue was opened via the bug report template. label Jan 23, 2024
@github-actions github-actions bot added Runtime Related to Node.js or Edge Runtime with Next.js. Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). Image (next/image) Related to Next.js Image Optimization. labels Jan 23, 2024
@HassanIyan

This comment has been minimized.

@rusakovic
Copy link
Author

In addition, I get this error

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NextNodeServer.runEdgeFunction (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:1225:13)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:247:37)
    at async NextNodeServer.handleRequestImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:807:17)
    at async invokeRender (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:163:21)
    at async handleRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:342:24)
    at async requestHandlerImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:366:13)
    at async Server.requestListener (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:140:13) {
  [cause]: RuntimeError: memory access out of bounds
      at wasm://wasm/005420d6:wasm-function[30]:0x3d9f3
      at new a7 (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:57743)
      at new si (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:61382)
      at sp (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:65344)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.start (/app/.next/server/app/remote-jobs/[slug]/opengraph-image/route.js:88:68482)
}

@efd1
Copy link

efd1 commented Feb 14, 2024

I had the same error

⨯ Error: failed to pipe response
    at pipeToNodeResponse (/app/node_modules/next/dist/server/pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NextNodeServer.runEdgeFunction (/app/node_modules/next/dist/server/next-server.js:1221:13)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:242:37)
    at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:805:17) {
  [cause]: Error: SVG data parsing failed cause unknown token at 1:2
      at e.wbg.__wbg_new_15d3966e9981a196 
	…

In my case, I just removed the xml tag from my svg (it was created with Sketch), and I no longer had the error:
<?xml version="1.0" encoding="UTF-8"?>

I only had the error self hosted on a VPS, not on Vercel

@drazik
Copy link

drazik commented Feb 20, 2024

I get the same error in the same use case. I don't have the xml tag in my svg files.

The error also seems to occur randomly. At least there is doesn't occurs everytime and I can't see a clear pattern for now.

I am hosting on a VPS.

@HassanIyan

This comment has been minimized.

@samcx
Copy link
Member

samcx commented Mar 11, 2024

@rusakovic Can you verify if you are seeing this with Next.js version 14.1.3? That version actually had a update with the Edge Runtime that was seeing memory issues.

@rusakovic
Copy link
Author

Hello @samcx Thank you for your response. I switched to the official Nexjts Docker Compose implementation -> no memory leaks now.

@samcx
Copy link
Member

samcx commented Mar 11, 2024

@rusakovic Good to know!

I will be closing this in the meantime then.

@ethteck
Copy link

ethteck commented Mar 13, 2024

We're on next 13.5.6 and getting

RuntimeError: memory access out of bounds
    at wasm://wasm/005420d6:wasm-function[30]:0x3d9f3
    at new o7 (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:147:58693)
    at new ie (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:147:63111)
    at render (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:147:67140)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.start (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:147:67445)

Am I understanding correctly that the issue is fixed in 14.1.3 (or beyond)? Or if it's still not fixed, would it be helpful for me to open a separate issue? I wasn't sure if the closure of this issue was more about the SVG parsing error or not

@samcx
Copy link
Member

samcx commented Mar 13, 2024

@ethteck Yes—it was likely fixed with this :pr:#62955, which is in https://github.com/vercel/next.js/releases/tag/v14.1.3 and above.

@ethteck
Copy link

ethteck commented Mar 13, 2024

thanks!

@ethteck
Copy link

ethteck commented Mar 23, 2024

Unfortunately on 14.1.4 I'm still seeing this issue:

  [cause]: RuntimeError: memory access out of bounds
      at wasm://wasm/005420d6:wasm-function[30]:0x3d9f3
      at new a9 (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:83:57761)
      at new so (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:83:61611)
      at sd (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:83:65573)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.start (/var/www/decomp.me/repo/frontend/.next/server/app/scratch/[slug]/opengraph-image/route.js:83:68712)

I see 5.5/7.58G of memory used on the device, so I don't think this is due to memory scarcity, but I'm not 100% sure

edit: after restarting the next.js server, memory usage dropped to only 200MB from the 2000+ it was using earlier. this seems like a memory leak

@mkst
Copy link

mkst commented Mar 23, 2024

Reproduced locally after running curl for ~20 mins in a while/do loop:

frontend-1  |  ⨯ Error: failed to pipe response
frontend-1  |     at pipeToNodeResponse (/frontend/node_modules/next/dist/server/pipe-readable.js:111:15)
frontend-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
frontend-1  |     at async DevServer.runEdgeFunction (/frontend/node_modules/next/dist/server/next-server.js:1214:13)
frontend-1  |     at async NextNodeServer.handleCatchallRenderRequest (/frontend/node_modules/next/dist/server/next-server.js:245:37)
frontend-1  |     at async DevServer.handleRequestImpl (/frontend/node_modules/next/dist/server/base-server.js:791:17)
frontend-1  |     at async /frontend/node_modules/next/dist/server/dev/next-dev-server.js:331:20
frontend-1  |     at async Span.traceAsyncFn (/frontend/node_modules/next/dist/trace/trace.js:151:20)
frontend-1  |     at async DevServer.handleRequest (/frontend/node_modules/next/dist/server/dev/next-dev-server.js:328:24)
frontend-1  |     at async invokeRender (/frontend/node_modules/next/dist/server/lib/router-server.js:174:21)
frontend-1  |     at async handleRequest (/frontend/node_modules/next/dist/server/lib/router-server.js:353:24)
frontend-1  |     at async requestHandlerImpl (/frontend/node_modules/next/dist/server/lib/router-server.js:377:13)
frontend-1  |     at async Server.requestListener (/frontend/node_modules/next/dist/server/lib/start-server.js:140:13) {
frontend-1  |   [cause]: Error: SVG data parsing failed cause unknown token at 1:1
frontend-1  |       at imports.wbg.__wbg_new_15d3966e9981a196 (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@vercel/og/index.edge.js:18473:17)
frontend-1  |       at wasm://wasm/005420d6:wasm-function[515]:0x112c4c
frontend-1  |       at wasm://wasm/005420d6:wasm-function[30]:0x3ffde
frontend-1  |       at new Resvg (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@vercel/og/index.edge.js:18355:12)
frontend-1  |       at new Resvg2 (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@vercel/og/index.edge.js:18571:5)
frontend-1  |       at render (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@vercel/og/index.edge.js:18789:19)
frontend-1  |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
frontend-1  |       at async Object.start (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@vercel/og/index.edge.js:19007:25)
frontend-1  | }
frontend-1  | GET http://backend:8000/api/scratch/y9Xei

next-server is using a lot of memory:
image

@mkst
Copy link

mkst commented Mar 24, 2024

@samcx, please can this issue be reopened so the root cause of the memory leak can be investigated? For some reason, resvg/resvg2 is being given garbage data to try to parse.

I think it's tricky to debug, I also don't know where this code lives (besides looking at index.edge.js on npmjs).

Could it be that the image data is never free'd? The memory usage seemed to raise around 5mb per request...

Edit:

I tried adding some console.log() statements to each function inside the RenderedImage class, I don't see free() being called:

frontend-1  | RenderedImage.__wrap()
frontend-1  | RenderedImage.asPng()

It's fair to say I'm just hacking around, but if I call free here, the memory usage is much more sensible (it grows at maybe 500kb/request):

--- node_modules/next/dist/compiled/@vercel/og/index.edge.js.orig	2024-03-24 19:43:50.664334383 +0000
+++ node_modules/next/dist/compiled/@vercel/og/index.edge.js	2024-03-24 19:44:02.624426590 +0000
@@ -18784,7 +18784,10 @@
       value: options.width
     }
   });
-  return resvgJS.render().asPng();
+  const image = resvgJS.render();
+  const png = image.asPng();
+  image.free();
+  return png;
 }
 
 // src/figma/index.tsx}

Been running curl on a loop for 20+ minutes and memory is significantly lower than without this change:
image

@jnm733
Copy link

jnm733 commented Mar 26, 2024

I have the same problem in 14.1.3

When I use an SVG in an OG ImageResponse, it generates memory leaks and errors in a short period of time.

Error: SVG data parsing failed cause unknown token at 1:1

Edit: I have the problem without using SVG too.

Captura de pantalla 2024-03-26 a las 9 08 38

@samcx samcx reopened this Mar 26, 2024
@samcx
Copy link
Member

samcx commented Mar 26, 2024

@ethteck @mkst We'll need a simple :repro: to take a look at this!

@mkst
Copy link

mkst commented Mar 27, 2024

I have created a repo to clearly demonstrate the issue.

First load of the image:
image

Load after it's been loaded a number of times:
image

After a minute or so, the error occurs:

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (/og/my-app/node_modules/next/dist/server/pipe-readable.js:111:15)
    at async sendResponse (/og/my-app/node_modules/next/dist/server/send-response.js:40:13)
    at async doRender (/og/my-app/node_modules/next/dist/server/base-server.js:1347:25)
    at async cacheEntry.responseCache.get.routeKind (/og/my-app/node_modules/next/dist/server/base-server.js:1527:40)
    at async DevServer.renderToResponseWithComponentsImpl (/og/my-app/node_modules/next/dist/server/base-server.js:1447:28)
    at async DevServer.renderPageComponent (/og/my-app/node_modules/next/dist/server/base-server.js:1844:24)
    at async DevServer.renderToResponseImpl (/og/my-app/node_modules/next/dist/server/base-server.js:1882:32)
    at async DevServer.pipeImpl (/og/my-app/node_modules/next/dist/server/base-server.js:895:25)
    at async NextNodeServer.handleCatchallRenderRequest (/og/my-app/node_modules/next/dist/server/next-server.js:269:17)
    at async DevServer.handleRequestImpl (/og/my-app/node_modules/next/dist/server/base-server.js:791:17)
    at async /og/my-app/node_modules/next/dist/server/dev/next-dev-server.js:331:20
    at async Span.traceAsyncFn (/og/my-app/node_modules/next/dist/trace/trace.js:151:20)
    at async DevServer.handleRequest (/og/my-app/node_modules/next/dist/server/dev/next-dev-server.js:328:24)
    at async invokeRender (/og/my-app/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async handleRequest (/og/my-app/node_modules/next/dist/server/lib/router-server.js:353:24) {
  [cause]: Error: 
      at imports.wbg.__wbg_new_15d3966e9981a196 (file:///og/my-app/node_modules/next/dist/compiled/@vercel/og/index.node.js:18465:17)
      at wasm://wasm/005420d6:wasm-function[515]:0x112c4c
      at wasm://wasm/005420d6:wasm-function[30]:0x3ffde
      at new Resvg (file:///og/my-app/node_modules/next/dist/compiled/@vercel/og/index.node.js:18347:12)
      at new Resvg2 (file:///og/my-app/node_modules/next/dist/compiled/@vercel/og/index.node.js:18563:5)
      at render (file:///og/my-app/node_modules/next/dist/compiled/@vercel/og/index.node.js:18783:19)
      at async Object.start (file:///og/my-app/node_modules/next/dist/compiled/@vercel/og/index.node.js:19006:25)
}

I'm running this on a machine with 128GB RAM and it's getting nowhere close to the limit before it stops working:
image

@ramzanh
Copy link

ramzanh commented Mar 27, 2024

I have the same issue on version 14.1.4 when using node runtime to generate openGraph images at build time

@HassanIyan
Copy link

any fixes

@IRediTOTO
Copy link

IRediTOTO commented May 25, 2024

I have this error too but with the image. In my case on localhost, I just need npm run dev again to see error gone.

@thibaultmthh
Copy link

I have the error to, in localhost it work tho

@upacyxou
Copy link

bump, very annoying issue

@vlkmx

This comment has been minimized.

@ethteck
Copy link

ethteck commented Jul 3, 2024

Could we get an update on this? It seems several others are affected by the memory leak.

Related issues (I think these are all the same root problem):
#54482
#44685
#65451
#66103

@ggomaeng
Copy link

ggomaeng commented Jul 4, 2024

also affected 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization. Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests