Skip to content

Search params in image remote patterns errors un-configured host #78076

Closed as duplicate of#80294
@ghost

Description

Link to the code that reproduces this issue

https://github.com/weavedfreedunes/next.js-image-host-search

To Reproduce

  1. Add a URL to remotePatterns in next.config.js with the ** wildcard.
  2. Use an <Image> component with a URL using that domain and search params.

Current vs. Expected behavior

Currently, this results in an error about the hostname not being configured in remotePatterns. This error should not happen as the hostname is configured.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 7741
  Available CPU cores: 8
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.8.0
Relevant Packages:
  next: 15.3.0 // Latest available version is detected (15.3.0).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Image (next/image)

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

This issue happens because the relevant matcher checks whether a search exists by comparing URL.search to undefined; however, URL.search will return an empty string if not defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions