Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imgix loader not working with path as empty string #30896

Closed
arnarthor opened this issue Nov 3, 2021 · 2 comments
Closed

Imgix loader not working with path as empty string #30896

arnarthor opened this issue Nov 3, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@arnarthor
Copy link

What version of Next.js are you using?

12.0.2

What version of Node.js are you using?

16.3.0

What browser are you using?

Safari/Brave

What operating system are you using?

macOS

How are you deploying your application?

Netlify

Describe the Bug

After updating to Next 12.0.2 (from 11.1.2) I can no longer have the imgix loader configured in next.config.js with the path as an empty string.

Error message that I get

Error: Specified images.loader property (imgix) also requires images.path property to be assigned to a URL prefix.
See more info here: https://nextjs.org/docs/api-reference/next/image#loader-configuration
    at assignDefaults (/Users/arnarthor/code/website/node_modules/next/server/config.ts:297:13)
    at Object.loadConfig [as default] (/Users/arnarthor/code/website/node_modules/next/server/config.ts:603:7)
    at async NextServer.loadConfig (/Users/arnarthor/code/website/node_modules/next/server/next.ts:124:18)
    at async NextServer.prepare (/Users/arnarthor/code/website/node_modules/next/server/next.ts:96:20)

The reason I need this is because I load my images from Prismic, which uses imgix behind the scenes, so it's the same imgix API, I just don't have direct access to the filenames because they are dynamically loaded from a CMS.

We load our images using their API so an example of our image component is
<Image src={prismicData.image.url} alt={prismicData.image.alt} />

This means we can't use a path prefix because it will append the path in front of the prismic response that we get.

Prismic also returns us different URLs based on if it's a PNG or an SVG. Meaning we get SVGs from my-website.cdn.prismic.io while we get PNGs from images.prismic.io but there is no difference in the API response apart from the URL for these types.

Expected Behavior

Allow me to continue using the images: {loader: "imgix", path: ""}

To Reproduce

Create a next.config.js with {images: {loader: "imgix", path: ""}}

@arnarthor arnarthor added the bug Issue was opened via the bug report template. label Nov 3, 2021
@timneutkens
Copy link
Member

This is fixed in #30741

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants