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

Remove upper limit on images.domains.length #20636

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion errors/invalid-images-config.md
Expand Up @@ -15,7 +15,6 @@ module.exports = {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
// limit of 25 imageSizes values
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
// limit of 50 domains values
domains: [],
path: '/_next/image',
// loader can be 'default', 'imgix', 'cloudinary', or 'akamai'
Expand Down
6 changes: 0 additions & 6 deletions packages/next/next-server/server/config.ts
Expand Up @@ -249,12 +249,6 @@ function assignDefaults(userConfig: { [key: string]: any }) {
)
}

if (images.domains.length > 50) {
throw new Error(
`Specified images.domains exceeds length of 50, received length (${images.domains.length}), please reduce the length of the array to continue.\nSee more info here: https://err.sh/next.js/invalid-images-config`
)
}

const invalid = images.domains.filter(
(d: unknown) => typeof d !== 'string'
)
Expand Down
25 changes: 0 additions & 25 deletions test/integration/image-optimizer/test/index.test.js
Expand Up @@ -447,31 +447,6 @@ function runTests({ w, isDev, domains }) {

describe('Image Optimizer', () => {
describe('config checks', () => {
it('should error when domains length exceeds 50', async () => {
await nextConfig.replace(
'{ /* replaceme */ }',
JSON.stringify({
images: {
domains: new Array(51).fill('google.com'),
},
})
)
let stderr = ''

app = await launchApp(appDir, await findPort(), {
onStderr(msg) {
stderr += msg || ''
},
})
await waitFor(1000)
await killApp(app).catch(() => {})
await nextConfig.restore()

expect(stderr).toContain(
'Specified images.domains exceeds length of 50, received length (51), please reduce the length of the array to continue'
)
})

it('should error when sizes length exceeds 25', async () => {
await nextConfig.replace(
'{ /* replaceme */ }',
Expand Down