diff --git a/examples/custom-server-typescript/nodemon.json b/examples/custom-server-typescript/nodemon.json index 00ea83db9500e..577991988d045 100644 --- a/examples/custom-server-typescript/nodemon.json +++ b/examples/custom-server-typescript/nodemon.json @@ -1,5 +1,5 @@ { - "watch": ["server", "static"], + "watch": ["server"], "exec": "ts-node --project tsconfig.server.json server/index.ts", "ext": "js ts" } diff --git a/lerna.json b/lerna.json index 653287e6c33e3..5da2da3e51ead 100644 --- a/lerna.json +++ b/lerna.json @@ -12,5 +12,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "9.2.3-canary.8" + "version": "9.2.3-canary.9" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index a21354c2b1859..36c9869a94b98 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "keywords": [ "react", "next", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 81fb4aae15774..74c86c06c0e80 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 270ba04414070..2b42ccb65cad7 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json index 95c89aa4efccf..ca37bc53e8075 100644 --- a/packages/next-plugin-google-analytics/package.json +++ b/packages/next-plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-google-analytics", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "nextjs": { "name": "Google Analytics", "required-env": [ diff --git a/packages/next-plugin-material-ui/package.json b/packages/next-plugin-material-ui/package.json index bbbc2a215227f..63a331bd18867 100644 --- a/packages/next-plugin-material-ui/package.json +++ b/packages/next-plugin-material-ui/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-material-ui", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "nextjs": { "name": "Material UI", "required-env": [] diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json index f49319e669978..b1347d0d51367 100644 --- a/packages/next-plugin-sentry/package.json +++ b/packages/next-plugin-sentry/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-sentry", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "nextjs": { "name": "Sentry", "required-env": [ diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index f3e563872b389..407a014f91752 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next/next-server/server/api-utils.ts b/packages/next/next-server/server/api-utils.ts index 17c3332bcb83c..340d4babd71f2 100644 --- a/packages/next/next-server/server/api-utils.ts +++ b/packages/next/next-server/server/api-utils.ts @@ -414,13 +414,19 @@ function clearPreviewData(res: NextApiResponse): NextApiResponse { ? previous : []), serialize(COOKIE_NAME_PRERENDER_BYPASS, '', { - maxAge: 0, + // To delete a cookie, set `expires` to a date in the past: + // https://tools.ietf.org/html/rfc6265#section-4.1.1 + // `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted. + expires: new Date(0), httpOnly: true, sameSite: 'strict', path: '/', }), serialize(COOKIE_NAME_PRERENDER_DATA, '', { - maxAge: 0, + // To delete a cookie, set `expires` to a date in the past: + // https://tools.ietf.org/html/rfc6265#section-4.1.1 + // `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted. + expires: new Date(0), httpOnly: true, sameSite: 'strict', path: '/', diff --git a/packages/next/package.json b/packages/next/package.json index feb8ff00c485c..b6e5e1f6c7dee 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "9.2.3-canary.8", + "version": "9.2.3-canary.9", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -73,7 +73,7 @@ "@babel/preset-typescript": "7.7.2", "@babel/runtime": "7.7.2", "@babel/types": "7.7.4", - "@next/polyfill-nomodule": "9.2.3-canary.8", + "@next/polyfill-nomodule": "9.2.3-canary.9", "amphtml-validator": "1.0.30", "async-retry": "1.2.3", "async-sema": "3.0.0", diff --git a/test/integration/prerender-preview/test/index.test.js b/test/integration/prerender-preview/test/index.test.js index 120be2cef3c59..c7f7058d02557 100644 --- a/test/integration/prerender-preview/test/index.test.js +++ b/test/integration/prerender-preview/test/index.test.js @@ -106,6 +106,7 @@ function runTests() { const cookies = res.headers .get('set-cookie') + .replace(/(=\w{3}),/g, '$1') .split(',') .map(cookie.parse) @@ -113,15 +114,17 @@ function runTests() { expect(cookies[0]).toMatchObject({ Path: '/', SameSite: 'Strict', - 'Max-Age': '0', + Expires: 'Thu 01 Jan 1970 00:00:00 GMT', }) expect(cookies[0]).toHaveProperty('__prerender_bypass') + expect(cookies[0]).not.toHaveProperty('Max-Age') expect(cookies[1]).toMatchObject({ Path: '/', SameSite: 'Strict', - 'Max-Age': '0', + Expires: 'Thu 01 Jan 1970 00:00:00 GMT', }) expect(cookies[1]).toHaveProperty('__next_preview_data') + expect(cookies[1]).not.toHaveProperty('Max-Age') }) /** @type import('next-webdriver').Chain */