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

fix(nextjs): Adjust shared imports to remove edge runtime warnings #1924

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

BRKalow
Copy link
Member

@BRKalow BRKalow commented Oct 20, 2023

Description

Updates our @clerk/shared imports to remove some warnings about importing unsupported methods in certain runtimes. As part of this, I've also moved some utils out of shared/utils into their own dedicated files so that they can be imported on their own.

  • isDevelopmentFromApiKey has been moved to shared/keys
  • isProductionFromApiKey has been moved to shared/keys
  • Moved callWithRetry into its top-level file

Example:

/node_modules/@clerk/shared/dist/esm/utils/localStorageBroadcastChannel.js
--
A Node.js API is used (MessageEvent at line: 23) which is not supported in the Edge Runtime.
Learn more: https://nextjs.org/docs/api-reference/edge-runtime
 
Import trace for requested module:
./node_modules/@clerk/shared/dist/esm/utils/localStorageBroadcastChannel.js
./node_modules/@clerk/shared/dist/esm/utils/index.js
./node_modules/@clerk/shared/dist/esm/index.js
./node_modules/@clerk/clerk-react/dist/esm/errors.js
./node_modules/@clerk/clerk-react/dist/esm/index.js
./node_modules/@clerk/nextjs/dist/esm/client-boundary/controlComponents.js
./node_modules/@clerk/nextjs/dist/esm/index.js

Note: This does not address the warnings that arise from import { authMiddleware } from '@clerk/nextjs'. This is a separate case that we'll need to handle differently.

related to JS-599

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:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@BRKalow BRKalow requested a review from a team as a code owner October 20, 2023 03:09
@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2023

🦋 Changeset detected

Latest commit: e8231f0

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

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Patch
@clerk/nextjs Patch
@clerk/shared Patch
@clerk/clerk-react Patch
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/clerk-js Patch
@clerk/clerk-expo Patch
@clerk/chrome-extension 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

@BRKalow BRKalow changed the title fix(nextjs): Adjust shared imports to remove runtime warnings on import fix(nextjs): Adjust shared imports to remove edge runtime warnings Oct 20, 2023
@LekoArts LekoArts added this pull request to the merge queue Oct 20, 2023
Merged via the queue into main with commit 92727ee Oct 20, 2023
12 checks passed
@LekoArts LekoArts deleted the brk.fix/next-address-runtime-import-warnings branch October 20, 2023 06:55
@clerk-cookie clerk-cookie mentioned this pull request Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants