Skip to content

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

Merged
thiskevinwang merged 4 commits into
mainfrom
kevin/remove-expo-headers
May 10, 2024
Merged

feat(clerk-expo): Remove headers causing CORS errors#3326
thiskevinwang merged 4 commits into
mainfrom
kevin/remove-expo-headers

Conversation

@thiskevinwang

@thiskevinwang thiskevinwang commented May 6, 2024

Copy link
Copy Markdown
Member

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:

@changeset-bot

changeset-bot Bot commented May 6, 2024

Copy link
Copy Markdown

🦋 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
Copy Markdown
Contributor

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
Copy Markdown
Member 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

@panteliselef panteliselef left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Comment thread .changeset/sweet-beds-pump.md Outdated
Comment on lines +5 to +7
Remove headers that were added in #2528

Remove `expo-application` & `expo-constants` peer deps

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member 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
Copy Markdown
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
Copy Markdown
Member 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
@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