Conversation
🦋 Changeset detectedLatest commit: 18ae827 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
LekoArts
commented
Dec 4, 2023
Comment on lines
+46
to
+60
| .addFile( | ||
| 'src/app/provider.tsx', | ||
| () => `'use client' | ||
| import { ClerkProvider } from "@clerk/nextjs" | ||
|
|
||
| export function Provider({ children }: { children: any }) { | ||
| return ( | ||
| <ClerkProvider> | ||
| {children} | ||
| </ClerkProvider> | ||
| ) | ||
| }`, | ||
| ) | ||
| .addFile( | ||
| 'src/app/layout.tsx', |
Contributor
Author
There was a problem hiding this comment.
The test did not run without these additions. The next-build.test.ts file has the same additions.
Why is the base template not just including these?
Comment on lines
+44
to
+55
| response2.cookies.set('foo', '1'); | ||
| response2.cookies.set({ | ||
| name: 'second', | ||
| value: '2', | ||
| path: '/', | ||
| sameSite: 'none', | ||
| secure: true, | ||
| }); | ||
| response2.cookies.set('bar', '1', { | ||
| sameSite: 'none', | ||
| secure: true, | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
The user reproduction used this format and while adding it the tests failed because sameSite and secure weren't passed through
Co-authored-by: Tom Milewski <[email protected]>
This was referenced Dec 5, 2023
LekoArts
added a commit
that referenced
this pull request
Dec 5, 2023
…sible (#2244) * fix(nextjs): If res is NextResponse just return it * fix(nextjs): Support options when setting cookies * chore(repo): Add initial next middleware test * chore(repo): Make test work * chore(repo): Add changeset * Update packages/nextjs/src/utils/response.test.ts Co-authored-by: Tom Milewski <[email protected]> --------- Co-authored-by: Tom Milewski <[email protected]> (cherry picked from commit b892ac6)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 5, 2023
…sible (#2244) (#2260) * fix(nextjs): If res is NextResponse just return it * fix(nextjs): Support options when setting cookies * chore(repo): Add initial next middleware test * chore(repo): Make test work * chore(repo): Add changeset * Update packages/nextjs/src/utils/response.test.ts Co-authored-by: Tom Milewski <[email protected]> --------- Co-authored-by: Tom Milewski <[email protected]> (cherry picked from commit b892ac6) Co-authored-by: Lennart <[email protected]>
tmilewski
added a commit
that referenced
this pull request
Dec 6, 2023
…sible (#2244) * fix(nextjs): If res is NextResponse just return it * fix(nextjs): Support options when setting cookies * chore(repo): Add initial next middleware test * chore(repo): Make test work * chore(repo): Add changeset * Update packages/nextjs/src/utils/response.test.ts Co-authored-by: Tom Milewski <[email protected]> --------- Co-authored-by: Tom Milewski <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the
mergeResponseshelper insidenextjswe normalize the incoming responses (which can beNextResponseorResponse) by passing through theresto anew NextResponse().In that process somehow the
cookiesare getting removed (except for the first one). This PR addresses this issue by just skipping this normalization if the incoming reponse is already aNextResponse.Additionally, while updating some unit tests I also saw that we didn't pass along the
optionsforcookies.set().Fixes #1897
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore