Unverified Commit 82ad0dd2 authored by Brooke's avatar Brooke Committed by GitHub

[nextjs] feat: removing length requirement (#89173)

Not a hard requirement so removing in [response to
request](https://github.com/vercel/next.js/pull/88958#discussion_r2735487290)
parent 1104c45f
---
title: '`deploymentId` exceeds maximum length'
---
## Why This Error Occurred
The `deploymentId` in your `next.config.js` exceeds the maximum length of 32 characters.
## Possible Ways to Fix It
### Option 1: Shorten Your Deployment ID
Reduce the length of your `deploymentId` to 32 characters or less:
```js
// next.config.js
module.exports = {
deploymentId: 'my-short-id', // ✅ 12 characters
}
```
### Option 2: Truncate Environment Variables
If using environment variables, ensure the value is truncated to 32 characters:
```js
// next.config.js
module.exports = {
deploymentId: process.env.DEPLOYMENT_ID?.substring(0, 32),
}
```
## Additional Information
- The deployment ID is used for skew protection and asset versioning
- Keep it concise but meaningful for your use case
- Consider using hashes or shortened identifiers if you need unique values
...@@ -985,7 +985,6 @@ ...@@ -985,7 +985,6 @@
"984": "LRUCache: calculateSize returned %s, but size must be > 0. Items with size 0 would never be evicted, causing unbounded cache growth.", "984": "LRUCache: calculateSize returned %s, but size must be > 0. Items with size 0 would never be evicted, causing unbounded cache growth.",
"985": "No response is returned from route handler '%s'. Expected a Response object but received '%s' (method: %s, url: %s). Ensure you return a \\`Response\\` or a \\`NextResponse\\` in all branches of your handler.", "985": "No response is returned from route handler '%s'. Expected a Response object but received '%s' (method: %s, url: %s). Ensure you return a \\`Response\\` or a \\`NextResponse\\` in all branches of your handler.",
"986": "Server Action arguments list is too long (%s). Maximum allowed is %s.", "986": "Server Action arguments list is too long (%s). Maximum allowed is %s.",
"987": "Invalid \\`deploymentId\\` configuration: exceeds maximum length of 32 characters. See https://nextjs.org/docs/messages/deploymentid-too-long", "987": "Invalid \\`deploymentId\\` configuration: must be a string. See https://nextjs.org/docs/messages/deploymentid-not-a-string",
"988": "Invalid \\`deploymentId\\` configuration: must be a string. See https://nextjs.org/docs/messages/deploymentid-not-a-string", "988": "Invalid \\`deploymentId\\` configuration: contains invalid characters. Only alphanumeric characters, hyphens, and underscores are allowed. See https://nextjs.org/docs/messages/deploymentid-invalid-characters"
"989": "Invalid \\`deploymentId\\` configuration: contains invalid characters. Only alphanumeric characters, hyphens, and underscores are allowed. See https://nextjs.org/docs/messages/deploymentid-invalid-characters"
} }
...@@ -978,11 +978,6 @@ export default async function build( ...@@ -978,11 +978,6 @@ export default async function build(
`Invalid \`deploymentId\` configuration: must be a string. See https://nextjs.org/docs/messages/deploymentid-not-a-string` `Invalid \`deploymentId\` configuration: must be a string. See https://nextjs.org/docs/messages/deploymentid-not-a-string`
) )
} }
if (config.deploymentId.length > 32) {
throw new Error(
`Invalid \`deploymentId\` configuration: exceeds maximum length of 32 characters. See https://nextjs.org/docs/messages/deploymentid-too-long`
)
}
if (!/^[a-zA-Z0-9_-]*$/.test(config.deploymentId)) { if (!/^[a-zA-Z0-9_-]*$/.test(config.deploymentId)) {
throw new Error( throw new Error(
`Invalid \`deploymentId\` configuration: contains invalid characters. Only alphanumeric characters, hyphens, and underscores are allowed. See https://nextjs.org/docs/messages/deploymentid-invalid-characters` `Invalid \`deploymentId\` configuration: contains invalid characters. Only alphanumeric characters, hyphens, and underscores are allowed. See https://nextjs.org/docs/messages/deploymentid-invalid-characters`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment