Reference
INVALID_IMAGE_OPTIMIZE_REQUEST
The query string is using an invalid value for q, w, or url parameters. This is a request error.Table of Contents
The INVALID_IMAGE_OPTIMIZE_REQUEST
error occurs when the query string is using an invalid value for q
(quality) or w
(width), or url
returns a non-image response.
400
INVALID_IMAGE_OPTIMIZE_REQUEST
Bad Request
To troubleshoot this error, follow these steps:
- Check for typos: Verify that there are no typos in the parameter names or values
- Review request format: Ensure that the request URL is correctly formatted and includes the required parameters
- The
q
parameter controls the quality of the image and must follow these rules:- The
q
parameter must be an integer - The
q
integer must be greater than or equal to 1 - The
q
integer must be less than or equal to 100
- The
- The
w
parameter defines the width of the image and must follow these rules:- The
w
parameter must be an integer - The
w
integer must be the same as one specified indeviceSizes
orimageSizes
in yournext.config.js
.
- The
- The
url
parameter specifies the image location and must follow these rules:- The
url
parameter must start with/
,http://
, orhttps://
- The
url
parameter must match one of the configuredremotePatterns
orlocalPatterns
in yournext.config.js
- The
url
parameter must have aContent-Type
header that starts withimage/
- The
url
parameter must have a response body less than 300 MB, otherwise the image won't be optimized.
- The
- The
Run next dev
locally to reproduce the error and get additional details.
Last updated on October 31, 2024
Was this helpful?