Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clerk-expo): Remove headers causing CORS errors #3326

Merged
merged 4 commits into from
May 10, 2024

Conversation

thiskevinwang
Copy link
Contributor

@thiskevinwang thiskevinwang commented May 6, 2024

Description

This removes two headers, added in #2528, that are resulting in CORS errors being returned from the Clerk Frontend API.

Related:

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:

Copy link

changeset-bot bot commented May 6, 2024

🦋 Changeset detected

Latest commit: 9e6b63f

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 Minor

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

@thiskevinwang thiskevinwang changed the title feat(clerk-expo): Remove headers - this reverts #2528 feat(clerk-expo): Remove headers causing CORS errors May 6, 2024
@thiskevinwang thiskevinwang marked this pull request as ready for review May 6, 2024 16:12
Comment on lines -47 to -52
// Send some non-identifying headers that are useful for logging
(requestInit.headers as Headers).set('x-expo-execution-environment', Constants.executionEnvironment);
(requestInit.headers as Headers).set(
'x-expo-native-application-version',
Application.nativeApplicationVersion || 'NULL',
);
Copy link
Member

Choose a reason for hiding this comment

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

@thiskevinwang If having this kind of information was useful, and don't wanna completely removed it, couldn't we just do this ?

if(!isValidBrowser()) {
      // Send some non-identifying headers that are useful for logging
      (requestInit.headers as Headers).set('x-expo-execution-environment', Constants.executionEnvironment);
      (requestInit.headers as Headers).set(
        'x-expo-native-application-version',
        Application.nativeApplicationVersion || 'NULL',
      );
}

of use import { Platform } from 'react-native';

if (Platform.OS !== 'web') {
      // Send some non-identifying headers that are useful for logging
      (requestInit.headers as Headers).set('x-expo-execution-environment', Constants.executionEnvironment);
      (requestInit.headers as Headers).set(
        'x-expo-native-application-version',
        Application.nativeApplicationVersion || 'NULL',
      );
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@panteliselef Oh, smart thinking! But also...

If having this kind of information was useful

...Turns out, it was not particularly useful so I'd say we just remove this!

@thiskevinwang thiskevinwang requested a review from panteliselef May 8, 2024 16:42
@thiskevinwang thiskevinwang force-pushed the kevin/remove-expo-headers branch from 75c227f to e392c80 Compare May 8, 2024 16:42
Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 5 to 7
Remove headers that were added in #2528

Remove `expo-application` & `expo-constants` peer deps
Copy link
Member

Choose a reason for hiding this comment

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

@thiskevinwang Maybe we could make this a little bit easier to read, as it'll be included in the changelog which is facing the developers using our product. For example, let's mention what are the headers this change removes. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 05e82b4

Copy link
Contributor

Choose a reason for hiding this comment

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

@thiskevinwang You should also remove those dependencies from the devDependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 05e82b4

@thiskevinwang thiskevinwang enabled auto-merge (squash) May 10, 2024 18:46
@thiskevinwang thiskevinwang merged commit d76723d into main May 10, 2024
10 checks passed
@thiskevinwang thiskevinwang deleted the kevin/remove-expo-headers branch May 10, 2024 19:25
@clerk-cookie clerk-cookie mentioned this pull request May 10, 2024
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.

5 participants