Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 1 addition & 57 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,62 +39,6 @@ The main Next.js framework lives in `packages/next/`. This is what gets publishe
- `packages/font/` - `next/font` implementation
- `packages/third-parties/` - Third-party script integrations

## Git Workflow

**CRITICAL: Use Graphite (`gt`) instead of git for ALL branch and commit operations.**

NEVER use these git commands directly:

- `git push` → use `gt submit --no-edit`
- `git branch` → use `gt create`

**Graphite commands:**

- `gt create <branch-name> -m "message"` - Create a new branch with commit
- `gt modify -a --no-edit` - Stage all and amend current branch's commit
- `gt checkout <branch>` - Switch branches
- `gt sync` - Sync and restack all branches
- `gt submit --no-edit` - Push and create/update PRs
- `gt log short` - View stack status

**Note**: `gt submit` runs in interactive mode by default and won't push in automated contexts. Always use `gt submit --no-edit` or `gt submit -q` when running from Claude.

**Creating PRs with descriptions**: All PRs created require a description. `gt submit --no-edit` creates PRs in draft mode without a description. To add a PR title and description, use `gh pr edit` immediately after submitting. The PR description needs to follow the mandatory format of .github/pull_request_template.md in the repository:

```bash
gt submit --no-edit
gh pr edit <pr-number> --body "Place description here"
```

**Graphite Stack Safety Rules:**

- Graphite force-pushes everything - old commits only recoverable via reflog
- Never have uncommitted changes when switching branches - they get lost during restack
- Never use `git stash` with Graphite - causes conflicts when `gt modify` restacks
- Never use `git checkout HEAD -- <file>` after editing - silently restores unfixed version
- Always use `gt checkout` (not `git checkout`) to switch branches
- `gt modify --no-edit` with unstaged/untracked files stages ALL changes
- `gt sync` pulls FROM remote, doesn't push TO remote
- `gt modify` restacks children locally but doesn't push them
- Always verify with `git status -sb` after stack operations
- When resuming from summarized conversation, never trust cached IDs - re-fetch from git/GitHub API

**Safe multi-branch fix workflow:**

```bash
gt checkout parent-branch
# make edits
gt modify -a --no-edit # Stage all, amend, restack children
git show HEAD -- <files> # VERIFY fix is in commit
gt submit --no-edit # Push immediately

gt checkout child-branch # Already restacked from gt modify
# make edits
gt modify -a --no-edit
git show HEAD -- <files> # VERIFY
gt submit --no-edit
```

## Build Commands

```bash
Expand Down Expand Up @@ -135,7 +79,7 @@ Only use full `pnpm --filter=next build` for one-off builds (after branch switch
**Always rebuild after switching branches:**

```bash
gt checkout <branch>
git checkout <branch>
pnpm build # Required before running tests (Turborepo dedupes if unchanged)
```

Expand Down
71 changes: 71 additions & 0 deletions errors/deploymentid-invalid-characters.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: '`deploymentId` contains invalid characters'
---

## Why This Error Occurred

The `deploymentId` in your `next.config.js` contains characters that are not allowed. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (\_) are permitted.

## Possible Ways to Fix It

### Option 1: Remove Invalid Characters

Remove or replace any characters that are not alphanumeric, hyphens, or underscores:

```js
// ✅ Correct
module.exports = {
deploymentId: 'my-deployment-123', // Only alphanumeric, hyphens, underscores
}

// ❌ Incorrect
module.exports = {
deploymentId: 'my deployment 123', // Contains spaces
deploymentId: 'my.deployment.123', // Contains dots
deploymentId: 'my/deployment/123', // Contains slashes
deploymentId: 'my@deployment#123', // Contains special characters
}
```

### Option 2: Sanitize the Deployment ID

If you're generating the ID from user input or other sources, sanitize it to remove invalid characters:

```js
// next.config.js
module.exports = {
deploymentId: () => {
const rawId = process.env.DEPLOYMENT_ID || 'default-id'
// Remove all characters that are not alphanumeric, hyphens, or underscores
return rawId.replace(/[^a-zA-Z0-9_-]/g, '')
},
}
```

### Option 3: Use a Valid Format

Common valid formats include:

```js
// next.config.js
module.exports = {
// Using hyphens
deploymentId: 'my-deployment-id',

// Using underscores
deploymentId: 'my_deployment_id',

// Alphanumeric only
deploymentId: 'mydeployment123',

// Mixed format
deploymentId: 'my-deployment_123',
}
```

## Additional Information

- The deployment ID is used for skew protection and asset versioning
- Invalid characters can cause issues with URL encoding and routing
- Keep the ID URL-friendly by using only the allowed character set
- The validation ensures compatibility across different systems and environments
34 changes: 34 additions & 0 deletions errors/deploymentid-not-a-string.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: '`deploymentId` function must return a string'
---

## Why This Error Occurred

The `deploymentId` option in your `next.config.js` is defined as a function, but it did not return a string value.

## Possible Ways to Fix It

Always return a string from your `deploymentId` function:

```js
// ✅ Correct
module.exports = {
deploymentId: () => {
return process.env.GIT_HASH || Date.now().toString()
},
}

// ❌ Incorrect
module.exports = {
deploymentId: () => {
// Missing return statement or returning non-string
return null
},
}
```

The `deploymentId` can be:

- A string: `deploymentId: 'my-deployment-123'`
- A function that returns a string: `deploymentId: () => process.env.GIT_HASH || ''`
- `undefined` (will be empty string, or use `NEXT_DEPLOYMENT_ID` environment variable if set)
51 changes: 51 additions & 0 deletions errors/deploymentid-too-long.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Deployment ID Too Long

The `deploymentId` in your `next.config.js` exceeds the maximum length of 32 characters.

## Why This Error Occurred

The `deploymentId` configuration option has a maximum length of 32 characters to ensure compatibility with various systems and constraints.

## 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: Use a Function to Generate a Shorter ID

If you're generating the ID dynamically, ensure it doesn't exceed 32 characters:

```js
// next.config.js
module.exports = {
deploymentId: () => {
// Generate a shorter ID (e.g., hash or truncate)
return process.env.GIT_COMMIT_SHA?.substring(0, 32) || 'default-id'
},
}
```
### Option 3: 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
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "16.2.0-canary.3"
"version": "16.2.0-canary.4"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"description": "ESLint configuration used by Next.js.",
"license": "MIT",
"repository": {
Expand All @@ -12,7 +12,7 @@
"dist"
],
"dependencies": {
"@next/eslint-plugin-next": "16.2.0-canary.3",
"@next/eslint-plugin-next": "16.2.0-canary.4",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.32.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/eslint-plugin-internal",
"private": true,
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"description": "ESLint plugin for working on Next.js.",
"exports": {
".": "./src/eslint-plugin-internal.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-routing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/routing",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-rspack",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "16.2.0-canary.3",
"version": "16.2.0-canary.4",
"private": true,
"files": [
"native/"
Expand Down
6 changes: 5 additions & 1 deletion packages/next/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -980,5 +980,9 @@
"979": "invariant: expected %s bytes of postponed state but only received %s bytes",
"980": "Failed to load client middleware manifest",
"981": "resolvedPathname must be set in request metadata",
"982": "`serializeResumeDataCache` should not be called in edge runtime."
"982": "`serializeResumeDataCache` should not be called in edge runtime.",
"983": "deploymentId function must return a string. https://nextjs.org/docs/messages/deploymentid-not-a-string",
"984": "The deploymentId \"%s\" cannot start with the \"dpl_\" prefix. Please choose a different deploymentId in your next.config.js. https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id",
"985": "The deploymentId \"%s\" exceeds the maximum length of 32 characters. Please choose a shorter deploymentId. https://nextjs.org/docs/messages/deploymentid-too-long",
"986": "The deploymentId \"%s\" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed. https://nextjs.org/docs/messages/deploymentid-invalid-characters"
}
Loading
Loading