Skip to content

Images are failing to be served (502 Error) using next/image #132

@bencodesall

Description

@bencodesall

Describe the bug
Using the next.js <Image /> component (next/image) my builds run perfectly. However I have a webp that is in the next public folder for my site logo which is failing to load on the page itself. I'm getting a 502 Bad Gateway error, but there's nothing in the build logs to indicate any problems.

To Reproduce
Steps to reproduce the behavior:

  1. Trigger build (preview, develop, production all exhibit the same behavior)

Expected behavior
I expect the @netlify/plugin-nextjs build plugin to enable Nextjs image optimization to just work, and be served in kind.

Versions

  • Next.js: 10.0.8
  • plugin (if installed at fixed version): Installed in TOML file below

If you're using the CLI to build
N/A - Build (dev, prod, export ... all) working locally

  • OS: [e.g. macOS, Windows]
  • netlify/cli version:

If you're using file-based installation

  • netlify.toml:
[build]
base = "/"
publish = "out/"
command = "yarn build"

## functions = "functions/"

[[plugins]]
package = "@netlify/plugin-nextjs"

[context.production]
publish = "out/"
command = "yarn build"

[context.deploy-preview]
publish = "out/"
command = "yarn build"

Additional Information
On a whim I did a direct GET and got back the following error on the image asset. This error leads me to believe there's something falling down on the server (or CDN) side that is failing to serve the image.

{
errorType: "Error",
errorMessage: "Unsupported MIME type: image/webp",
trace: [
"Error: Unsupported MIME type: image/webp",
" at Jimp.throwError (/var/task/src/node_modules/@jimp/utils/dist/index.js:33:13)",
" at Jimp.parseBitmap (/var/task/src/node_modules/@jimp/core/dist/utils/image-bitmap.js:198:32)",
" at Jimp.parseBitmap (/var/task/src/node_modules/@jimp/core/dist/index.js:431:32)",
" at /var/task/src/node_modules/@jimp/core/dist/index.js:373:15",
" at /var/task/src/node_modules/@jimp/core/dist/index.js:115:14",
" at /var/task/src/node_modules/@jimp/core/dist/request.js:48:9",
" at IncomingMessage.<anonymous> (/var/task/src/node_modules/phin/lib/phin.compiled.js:1:2100)",
" at IncomingMessage.emit (events.js:326:22)",
" at endReadableNT (_stream_readable.js:1241:12)",
" at processTicksAndRejections (internal/process/task_queues.js:84:21)"
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions