When ImageKit gets an error while trying to fetch the original image from your external origin, it responds with
404 status code along with a generic "Not Found" message like below:
To help you troubleshot the error, the response is accompanied by an
ik-error header, which expounds more detail about the nature of the error.
The value of
ik-error header is:
ERROR_CODE - ERROR_MESSAGE
For example, when you try to access an image from your AWS S3 bucket that doesn't exist, you will receive a
404 status code with an
ik-error header as follows:
ENOENT - No file was found on S3 at the specified path
You can use browser developer tools to inspect the response header and read the error message. For example, if we try to access the below non-existing image:
ImageKit returns a blank white page with a
Not Found message, but you can inspect the
ik-error header from the developer tools (Ctrl + Shift + i for Chrome) like this
This helps you identify that the error is caused because the file name specified in the URL does not exist on the origin. The origin, in this case, is an S3 bucket, but it can be any origin that ImageKit supports.
Similarly, the header may consist of one of the other possible error codes and an accompanying message:
It means the file does not exist at the given path on the origin server or object storage. Check the origin server associated with the URL-endpoint and ensure that the file exists.
Invalid or expired authentication credentials for the corresponding origin. In this case, you should check the credentials provided in the ImageKit dashboard while configuring origin and ensure that ImageKit.io has the necessary permission to access the file. In the case of web server origin, you should check firewall settings and whitelist our servers. In the case of object storage, you should ensure that the configured credential has read access.
Refer to limits to understand more about the reason for the error. The response status is
The external origin refused to connect. This usually happens if your origin web server has some maximum connection limit, or a firewall has blocked our request. You should check firewall settings and whitelist our servers.
The exact nature of the error could not be identified. This is rare, in this case, contact us at [email protected]