Skip to content

Conversation

@wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Sep 10, 2024

Description

This PR addresses an issue where the isMobile value of a SessionActivity is incorrectly set to false for iOS devices. The problem is caused by some iOS devices sending an empty user-agent header:

Here's an example of an expo login request in iOS (notice there's no user-agent header and isMobile is false):

Screenshot 2024-09-10 at 7 49 14 AM Screenshot 2024-09-10 at 8 47 05 AM

The backend relies on either the x-mobile or user-agent headers to determine if a request is from a mobile device. This update adds the x-mobile header for all native requests, ensuring that the backend correctly records session activities as mobile, regardless of the user-agent value.

Here's a SessionActivity record after signing in with a x-mobile header (notice isMobile is true):

Screenshot 2024-09-10 at 8 06 16 AM

Resolves ECO-189

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2024

🦋 Changeset detected

Latest commit: 2fc2705

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@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

@wobsoriano wobsoriano marked this pull request as ready for review September 10, 2024 15:40
Copy link
Member

@anagstef anagstef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wobsoriano wobsoriano merged commit da01be9 into main Sep 10, 2024
@wobsoriano wobsoriano deleted the rob/eco-189-incorrect-ios-mobile-sessions branch September 10, 2024 15:51
@wobsoriano
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @wobsoriano - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 1.3.1-snapshot.v2fc2705
@clerk/backend 1.10.1-snapshot.v2fc2705
@clerk/chrome-extension 1.3.3-snapshot.v2fc2705
@clerk/clerk-js 5.21.1-snapshot.v2fc2705
@clerk/elements 0.15.1-snapshot.v2fc2705
@clerk/clerk-expo 2.2.9-snapshot.v2fc2705
@clerk/express 0.0.38-snapshot.v2fc2705
@clerk/fastify 1.0.40-snapshot.v2fc2705
@clerk/localizations 3.0.1-snapshot.v2fc2705
@clerk/nextjs 5.5.1-snapshot.v2fc2705
@clerk/clerk-react 5.8.1-snapshot.v2fc2705
@clerk/remix 4.2.24-snapshot.v2fc2705
@clerk/clerk-sdk-node 5.0.37-snapshot.v2fc2705
@clerk/shared 2.7.1-snapshot.v2fc2705
@clerk/tanstack-start 0.3.7-snapshot.v2fc2705
@clerk/testing 1.2.20-snapshot.v2fc2705
@clerk/themes 2.1.29-snapshot.v2fc2705
@clerk/types 4.20.1-snapshot.v2fc2705

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@1.3.1-snapshot.v2fc2705 --save-exact

@clerk/backend

npm i @clerk/backend@1.10.1-snapshot.v2fc2705 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.3.3-snapshot.v2fc2705 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.21.1-snapshot.v2fc2705 --save-exact

@clerk/elements

npm i @clerk/elements@0.15.1-snapshot.v2fc2705 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.2.9-snapshot.v2fc2705 --save-exact

@clerk/express

npm i @clerk/express@0.0.38-snapshot.v2fc2705 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.40-snapshot.v2fc2705 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.0.1-snapshot.v2fc2705 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.5.1-snapshot.v2fc2705 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.8.1-snapshot.v2fc2705 --save-exact

@clerk/remix

npm i @clerk/remix@4.2.24-snapshot.v2fc2705 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.37-snapshot.v2fc2705 --save-exact

@clerk/shared

npm i @clerk/shared@2.7.1-snapshot.v2fc2705 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.3.7-snapshot.v2fc2705 --save-exact

@clerk/testing

npm i @clerk/testing@1.2.20-snapshot.v2fc2705 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.29-snapshot.v2fc2705 --save-exact

@clerk/types

npm i @clerk/types@4.20.1-snapshot.v2fc2705 --save-exact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants