Community Forum

Ask a Question
Back to All

NextJS 13 app directory localisation approach fails to load resources from local resources like images for next/image

Hey everyone,
I was happy to read your blog post on an how to achieve localisation in the new NextJS 13 app directory (https://locize.com/blog/next-13-app-dir-i18n/).

Unfortunately with my setup I cannot load local resources from the public folder. For example requests for image resources get denied with a 400 error.

ImageError: Unable to optimize image and unable to fallback to upstream image
     at imageOptimizer (/usr/src/app/node_modules/next/dist/server/image-optimizer.js:563:19)
     at async cacheEntry.imageResponseCache.get.incrementalCache (/usr/src/app/node_modules/next/dist/server/next-server.js:238:72)
     at async /usr/src/app/node_modules/next/dist/server/response-cache/index.js:83:36 {
     statusCode: 400
 }

I guess it has something todo with the middleware not redirecting properly for static resources.

I am using NextJS 13.1.

Did I forget a crucial step? I would be gratefull for hints and tips onto how to fix the issue.

Cheers
Luke