nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
400 stars 25 forks source link

how to fix [500] Cannot read properties of undefined (reading 'replaceAll') #99

Closed reslear closed 9 months ago

reslear commented 11 months ago

Describe the bug

hi @harlan-zw i have a one issue after migration to v2 in build step. maybe you had such a problem how to solve it)?

[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'replaceAll')
  at <anonymous> (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/nuxt-og-image@2.1.3_vue@3.3.4/node_modules/nuxt-og-image/dist/runtime/nitro/routes/html.mjs:133:15)  
  at async Object.handler (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/h3@1.8.2/node_modules/h3/dist/index.mjs:1630:19)  
  at async Server.toNodeHandle (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/h3@1.8.2/node_modules/h3/dist/index.mjs:1840:7)
devDependencies:
@nuxtseo/module 2.0.0-beta.15
└── nuxt-og-image 2.1.3

found problem in:

Screenshot 2023-10-17 at 19 43 25

and console error:

{
  island: '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=http://localhost/__nuxt_island/ogimagetemplatefallback_p6x6xpvzmw?props=%7B%22options%22:%22%7B%7D%22,%22path%22:%22/%22,%22timestamp%22:%221697564459459%22,%22scale%22:%221%22,%22mode%22:%22light%22,%22provider%22:%22satori%22,%22component%22:%22OgImageTemplateFallback%22,%22width%22:1200,%22height%22:630,%22cache%22:true,%22cacheTtl%22:86400000,%22title%22:%22Bg+%26+Memberships%22,%22description%22:%22Token-gate,+events,+and+physical+property+with+B%22,%22requestOrigin%22:%22http://localhost:3010/%22%7D"></head></html>'
}
[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'replaceAll')
  at <anonymous> (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/nuxt-og-image@2.1.3_vue@3.3.4/node_modules/nuxt-og-image/dist/runtime/nitro/routes/html.mjs:135:15)  
  at async Object.handler (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/h3@1.8.2/node_modules/h3/dist/index.mjs:1630:19)  
  at async Server.toNodeHandle (/Users/reslear/Documents/dev/work/b/mvp/node_modules/.pnpm/h3@1.8.2/node_modules/h3/dist/index.mjs:1840:7)
{ html: undefined }

https://github.com/harlan-zw/nuxt-og-image/blob/c89fd4e29f56eeb00b12bc0d7e4bcb82ab459cae/src/runtime/nitro/routes/html.ts#L71

so is set enabled: false we also have a problem:

Screenshot 2023-10-17 at 20 00 41

Reproduction

No response

System / Nuxt Info

No response

harlan-zw commented 11 months ago

Hi @reslear, sorry for the delay.

  1. Please upgrade to the latest @nuxtseo/module
  2. I'm not exactly sure why this error has occurred, I can only think that the island renderer isn't returning the correct content for some reason. Possibly a Nuxt version incompatibility? Please make sure you're using the latest (3.8.0)

Otherwise if you can provide any sort of reproduction I can help you further with this.