Skip to content

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

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

Open
weavedfreedunes opened this issue Apr 12, 2025 · 0 comments · May be fixed by #78077
Open

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

weavedfreedunes opened this issue Apr 12, 2025 · 0 comments · May be fixed by #78077
Labels
Image (next/image) Related to Next.js Image Optimization.

Comments

@weavedfreedunes
Copy link

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.

@github-actions github-actions bot added the Image (next/image) Related to Next.js Image Optimization. label Apr 12, 2025
weavedfreedunes added a commit to weavedfreedunes/next.js that referenced this issue Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant