You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an API endpoint which I've created to serve optimised/resized images. This is how it works:
a request to /api/1/media/w:400/filename.jpeg (route /api/1/media/[options]/[filename]/+server.ts)
the GET function parses the params and requests (via fetch) the original image file (located in /static/media/) and does the resizing and optimising
It sends it back to the browser.
This works just fine in dev and has, up until some recent change, worked just fine in production too, but now my builds are failing and I'm not sure why.
It fails during pre-rendering when visiting a page on the site that includes an image that would be generated by the method above. And to be more precise, it fails at the fetch with the following error.
Which results in the API endpoint returning a 500 for the image and the whole thing then falls over.
[vite-plugin-svelte-kit] Prerendering failed with code 1
Now my guess is that the build server during pre-rendering is run in a different way to the dev server (on a different port? in some completely different way?). But I don't know nearly enough about the build/pre-rendering process to get much further.
Any idea where I should look next to get this one solved?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have an API endpoint which I've created to serve optimised/resized images. This is how it works:
/api/1/media/w:400/filename.jpeg
(route/api/1/media/[options]/[filename]/+server.ts
)GET
function parses the params and requests (viafetch
) the original image file (located in/static/media/
) and does the resizing and optimisingThis works just fine in dev and has, up until some recent change, worked just fine in production too, but now my builds are failing and I'm not sure why.
It fails during pre-rendering when visiting a page on the site that includes an image that would be generated by the method above. And to be more precise, it fails at the
fetch
with the following error.Which results in the API endpoint returning a 500 for the image and the whole thing then falls over.
Now my guess is that the build server during pre-rendering is run in a different way to the dev server (on a different port? in some completely different way?). But I don't know nearly enough about the build/pre-rendering process to get much further.
Any idea where I should look next to get this one solved?
Beta Was this translation helpful? Give feedback.
All reactions