fix(clerk-js): Use first-party cookies when running on Cypress
Description
The issue:
Cypress discards third-party cookies. Also, it runs in an iframe.
If we detect that clerk-js runs inside an iframe, we set our cookies with SameSite: None (third-party).
So, the following cookies never get set in the browser:
__session__client_uat__clerk_db_jwt
Proposed solution:
Cypress adds a global object on the window, on the window.Cypress property. We can exclude cookies getting set as third-party if we detect that the app runs inside Cypress.
Checklist
- [x]
npm testruns as expected. - [x]
npm run buildruns as expected. - [ ] (If applicable) JSDoc comments have been added or updated for any package exports
- [ ] (If applicable) Documentation has been updated
Type of change
- [x] 🐛 Bug fix
- [ ] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other:
🦋 Changeset detected
Latest commit: fc3a263de6baf1b93b0eae804a7f0cfef0219313
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 3 packages
| Name | Type |
|---|---|
| @clerk/clerk-js | Patch |
| @clerk/chrome-extension | Patch |
| @clerk/clerk-expo | Patch |
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
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/chrome-extension | 1.0.1-snapshot.v3a06a37 |
| @clerk/clerk-js | 5.1.0-snapshot.v3a06a37 |
| @clerk/clerk-expo | 1.0.1-snapshot.v3a06a37 |
| @clerk/fastify | 1.0.1-snapshot.v3a06a37 |
| gatsby-plugin-clerk | 5.0.0-beta.45 |
| @clerk/localizations | 2.1.0-snapshot.v3a06a37 |
| @clerk/nextjs | 5.0.2-snapshot.v3a06a37 |
| @clerk/clerk-react | 5.0.1-snapshot.v3a06a37 |
| @clerk/remix | 4.0.1-snapshot.v3a06a37 |
| @clerk/themes | 2.0.1-snapshot.v3a06a37 |
| @clerk/types | 4.1.0-snapshot.v3a06a37 |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
@clerk/fastify
npm i @clerk/[email protected] --save-exact
gatsby-plugin-clerk
npm i [email protected] --save-exact
@clerk/localizations
npm i @clerk/[email protected] --save-exact
@clerk/nextjs
npm i @clerk/[email protected] --save-exact
@clerk/clerk-react
npm i @clerk/[email protected] --save-exact
@clerk/remix
npm i @clerk/[email protected] --save-exact
@clerk/themes
npm i @clerk/[email protected] --save-exact
@clerk/types
npm i @clerk/[email protected] --save-exact
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/backend | 1.0.1-snapshot.vbd3f75e |
| @clerk/chrome-extension | 1.0.1-snapshot.vbd3f75e |
| @clerk/clerk-js | 5.1.0-snapshot.vbd3f75e |
| @clerk/clerk-expo | 1.0.1-snapshot.vbd3f75e |
| @clerk/express | 0.0.2-snapshot.vbd3f75e |
| @clerk/fastify | 1.0.1-snapshot.vbd3f75e |
| gatsby-plugin-clerk | 5.0.0-beta.45 |
| @clerk/localizations | 2.1.0-snapshot.vbd3f75e |
| @clerk/nextjs | 5.0.2-snapshot.vbd3f75e |
| @clerk/clerk-react | 5.0.1-snapshot.vbd3f75e |
| @clerk/remix | 4.0.1-snapshot.vbd3f75e |
| @clerk/clerk-sdk-node | 5.0.1-snapshot.vbd3f75e |
| @clerk/testing | 1.0.0-snapshot.vbd3f75e |
| @clerk/themes | 2.0.1-snapshot.vbd3f75e |
| @clerk/types | 4.1.0-snapshot.vbd3f75e |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend
npm i @clerk/[email protected] --save-exact
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
@clerk/express
npm i @clerk/[email protected] --save-exact
@clerk/fastify
npm i @clerk/[email protected] --save-exact
gatsby-plugin-clerk
npm i [email protected] --save-exact
@clerk/localizations
npm i @clerk/[email protected] --save-exact
@clerk/nextjs
npm i @clerk/[email protected] --save-exact
@clerk/clerk-react
npm i @clerk/[email protected] --save-exact
@clerk/remix
npm i @clerk/[email protected] --save-exact
@clerk/clerk-sdk-node
npm i @clerk/[email protected] --save-exact
@clerk/testing
npm i @clerk/[email protected] --save-exact
@clerk/themes
npm i @clerk/[email protected] --save-exact
@clerk/types
npm i @clerk/[email protected] --save-exact
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/chrome-extension | 1.0.7-snapshot.v47a3ff9 |
| @clerk/clerk-js | 5.2.3-snapshot.v47a3ff9 |
| @clerk/clerk-expo | 1.0.7-snapshot.v47a3ff9 |
| gatsby-plugin-clerk | 5.0.0-beta.45 |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
gatsby-plugin-clerk
npm i [email protected] --save-exact