I have a page with the URL /tools/transcribe-to-text?format=mp3
The template is /tools/transcribe-to-text, and change the content based on the query parameter (for example, title will be "Transcribe your [•••] file to text")
I did not plan to have a "default" value in case there was no query parameter. When I tried to access the picture, I got an error saying the module couldn't resolve the path. But it also showed that the /api/og-image-options endpoint didn't took query parameters into consideration.
I added a default value to avoid the crash, but then it just shows the default value in the image.
If that helps, here is the error when I had no default value (meaning the page was returning internal error)
[nuxt] [request error] [unhandled] [500] [GET] "/api/og-image-options?path=/tools/transcribe-to-text": 500 Failed to read the path /tools/transcribe-to-text for og-image extraction. [GET] "/tools/transcribe-to-text": 500 .
at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.00501375.mjs:256:14)
at async $fetch2 (./node_modules/ofetch/dist/shared/ofetch.00501375.mjs:261:15)
at fetchOptions (./node_modules/nuxt-og-image/dist/runtime/nitro/utils.mjs:60:19)
at fetchOptionsCached (./node_modules/nuxt-og-image/dist/runtime/nitro/utils.mjs:55:19)
at <anonymous> (./node_modules/nuxt-og-image/dist/runtime/nitro/middleware/og.png.mjs:17:19)
at async Object.handler (./node_modules/h3/dist/index.mjs:1630:19)
at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:1840:7)
Describe the bug
Hey!
It seems like the query parameters aren't properly passed in the API URL
A fix could be to append the query parameters at the end of the API endpoint
/api/og-image-options?path=/page-path&query1=value1&query2=value2
Reproduction
I have a page with the URL /tools/transcribe-to-text?format=mp3
The template is /tools/transcribe-to-text, and change the content based on the
query
parameter (for example, title will be "Transcribe your [•••] file to text")I did not plan to have a "default" value in case there was no query parameter. When I tried to access the picture, I got an error saying the module couldn't resolve the path. But it also showed that the
/api/og-image-options
endpoint didn't took query parameters into consideration.I added a default value to avoid the crash, but then it just shows the default value in the image.
If that helps, here is the error when I had no default value (meaning the page was returning internal error)