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,shared): Revert "Use use client directive to support sha… #1806

Merged
merged 5 commits into from
Sep 29, 2023

Conversation

nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Sep 29, 2023

Temporarily resolve

 ⨯ node_modules/@clerk/shared/dist/cjs/hooks/createContextAndHook.js (43:35) @ createContext
 ⨯ createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
    at createContextAndHook (webpack-internal:///(rsc)/./node_modules/@clerk/shared/dist/cjs/hooks/createContextAndHook.js:48:38)
    at eval (webpack-internal:///(rsc)/./node_modules/@clerk/shared/dist/cjs/hooks/contexts.js:53:110)

Description

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

@nikosdouvlis nikosdouvlis requested a review from a team as a code owner September 29, 2023 18:35
@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2023

🦋 Changeset detected

Latest commit: cecf74d

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/shared Patch
@clerk/nextjs Patch
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/clerk-js Patch
@clerk/clerk-react 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

@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/chrome-extension 0.4.4-snapshot.e37df91
@clerk/clerk-js 4.59.1-snapshot.e37df91
@clerk/clerk-expo 0.19.6-snapshot.e37df91
gatsby-plugin-clerk 4.4.12-snapshot.e37df91
@clerk/nextjs 4.25.1-snapshot.e37df91
@clerk/clerk-react 4.26.1-snapshot.e37df91
@clerk/remix 3.0.3-snapshot.e37df91

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/chrome-extension
npm i @clerk/[email protected]
# @clerk/clerk-js
npm i @clerk/[email protected]
# @clerk/clerk-expo
npm i @clerk/[email protected]
# gatsby-plugin-clerk
npm i [email protected]
# @clerk/nextjs
npm i @clerk/[email protected]
# @clerk/clerk-react
npm i @clerk/[email protected]
# @clerk/remix
npm i @clerk/[email protected]

This reverts commit 00d9d42

Revert "chore(backend): Warn about apiKey deprecation"

This reverts commit 1a2f12b

Revert "chore(backend): Warn about httpOptions deprecation"

This reverts commit 838475b.

Revert "chore(backend): Warn about InterstitialAPI deprecation"

This reverts commit 51a5c39.

Revert "chore(backend): Warn about picture/logoUrl/profileImageUrl (image related) deprecations"

This reverts commit 077ce3a

Revert "chore(backend): Warn about pkgVersion deprecation"

This reverts commit 362caaa.

Revert "chore(backend): Warn about clockSkewInSeconds deprecation"

This reverts commit f500d46.

Revert "chore(backend): Warn about backend api return format deprecation"

This reverts commit c937990.

Revert "chore(backend): Warn about __unstable_options deprecation"

This reverts commit 54ba397.
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/chrome-extension 0.4.4-snapshot.aae1150
@clerk/clerk-js 4.59.1-snapshot.aae1150
@clerk/clerk-expo 0.19.6-snapshot.aae1150
gatsby-plugin-clerk 4.4.12-snapshot.aae1150
@clerk/nextjs 4.25.1-snapshot.aae1150
@clerk/clerk-react 4.26.1-snapshot.aae1150
@clerk/remix 3.0.3-snapshot.aae1150

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/chrome-extension
npm i @clerk/[email protected]
# @clerk/clerk-js
npm i @clerk/[email protected]
# @clerk/clerk-expo
npm i @clerk/[email protected]
# gatsby-plugin-clerk
npm i [email protected]
# @clerk/nextjs
npm i @clerk/[email protected]
# @clerk/clerk-react
npm i @clerk/[email protected]
# @clerk/remix
npm i @clerk/[email protected]

@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

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

Package Version
@clerk/backend 0.30.1-snapshot.cecf74d
@clerk/chrome-extension 0.4.4-snapshot.cecf74d
@clerk/clerk-js 4.59.1-snapshot.cecf74d
@clerk/clerk-expo 0.19.6-snapshot.cecf74d
@clerk/fastify 0.6.11-snapshot.cecf74d
gatsby-plugin-clerk 4.4.12-snapshot.cecf74d
@clerk/nextjs 4.25.1-snapshot.cecf74d
@clerk/clerk-react 4.26.1-snapshot.cecf74d
@clerk/remix 3.0.3-snapshot.cecf74d
@clerk/clerk-sdk-node 4.12.10-snapshot.cecf74d
@clerk/shared 0.24.1-snapshot.cecf74d

Tip: use the snippet copy button below to quickly install the required packages.

# @clerk/backend
npm i @clerk/[email protected]
# @clerk/chrome-extension
npm i @clerk/[email protected]
# @clerk/clerk-js
npm i @clerk/[email protected]
# @clerk/clerk-expo
npm i @clerk/[email protected]
# @clerk/fastify
npm i @clerk/[email protected]
# gatsby-plugin-clerk
npm i [email protected]
# @clerk/nextjs
npm i @clerk/[email protected]
# @clerk/clerk-react
npm i @clerk/[email protected]
# @clerk/remix
npm i @clerk/[email protected]
# @clerk/clerk-sdk-node
npm i @clerk/[email protected]
# @clerk/shared
npm i @clerk/[email protected]

@nikosdouvlis nikosdouvlis merged commit d2dd6e1 into main Sep 29, 2023
5 checks passed
@nikosdouvlis nikosdouvlis deleted the revert-1767 branch September 29, 2023 19:50
@clerk-cookie clerk-cookie mentioned this pull request Sep 29, 2023
@OwenVey
Copy link

OwenVey commented Oct 5, 2023

@nikosdouvlis I'm still seeing this error using 4.25.2.

 ⨯ node_modules/.pnpm/@[email protected][email protected]/node_modules/@clerk/shared/dist/esm/hooks/createContextAndHook.js (9:14) @ React
 ⨯ createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at __webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)
    at eval (./src/app/actions.ts:7:71)
    at (action-browser)/./src/app/actions.ts (/Users/owenvey/Developer/chowder/.next/server/app/recipes/new/page.js:587:1)
    at Function.__webpack_require__ (/Users/owenvey/Developer/chowder/.next/server/webpack-runtime.js:33:43)

and here is my action.ts file:

'use server';

import { db } from '@/lib/db';
import type { RecipeCreate } from '@/types';
import { auth } from '@clerk/nextjs';
import { redirect } from 'next/navigation';

export async function createRecipe(recipe: Omit<RecipeCreate, 'userId'>) {
  const { userId } = auth();
  if (!userId) {
    throw new Error('You must be signed in to create a new recipe');
  }

  const newRecipe = await db.recipe.create({ data: { ...recipe, userId } });
  redirect(`/recipes/${newRecipe.id}`);
}

@nikosdouvlis
Copy link
Member Author

@OwenVey Thank you for reporting this one, forwarding this to the team ASAP

@royanger
Copy link
Member

royanger commented Oct 5, 2023

@OwenVey, if you import the Server Action into a Server Component and then pass it as a prop to the Client Component does that resolve the issue?

@OwenVey
Copy link

OwenVey commented Oct 5, 2023

@royanger yeah, I was the one who posted it on Discord. I think it's definitely a Next.js issue

This was referenced Oct 5, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants