Skip to content

Image optimisation external resource not working #18412

Closed
@klaaz0r

Description

@klaaz0r

Bug report

Describe the bug

When optimising images from external sources I get the following error in production:

"url" parameter is not allowed

To Reproduce

Images are coming from: images.example.com

next.config.js has:

 images: {
      domains: ["images.example.com"],
    },

Expected behavior

The images should also be optimised in production/ from an external source.

Inside the PR for optimised images (https://github.com/vercel/next.js/pull/17749/files)

You can see where the error comes from but I am not sure why it is thrown, I am using a custom server but should not be a problem since it seems to work locally.

I added some logging to the code to check the inputs but based on this I do not find anything that would suggest !domains.includes(hrefParsed.hostname) this line would turn true

domains [ 'images.brabble.fm' ]
hrefParsed URL {
  href: 'https://images.brabble.fm/6f76e696-8ef1-46ff-be47-b7f85f14f36b.jpeg',
  origin: 'https://images.brabble.fm',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'images.brabble.fm',
  hostname: 'images.brabble.fm',
  port: '',
  pathname: '/6f76e696-8ef1-46ff-be47-b7f85f14f36b.jpeg',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions