Skip to content

fix(nextjs,shared): Revert "Use use client directive to support sha… - #1806

Merged
nikosdouvlis merged 5 commits into
mainfrom
revert-1767
Sep 29, 2023
Merged

fix(nextjs,shared): Revert "Use use client directive to support sha…#1806
nikosdouvlis merged 5 commits into
mainfrom
revert-1767

Conversation

@nikosdouvlis

@nikosdouvlis nikosdouvlis commented Sep 29, 2023

Copy link
Copy Markdown
Member

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

changeset-bot Bot commented Sep 29, 2023

Copy link
Copy Markdown

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

!snapshot

@clerk-cookie

Copy link
Copy Markdown
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/chrome-extension@0.4.4-snapshot.e37df91
# @clerk/clerk-js
npm i @clerk/clerk-js@4.59.1-snapshot.e37df91
# @clerk/clerk-expo
npm i @clerk/clerk-expo@0.19.6-snapshot.e37df91
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.4.12-snapshot.e37df91
# @clerk/nextjs
npm i @clerk/nextjs@4.25.1-snapshot.e37df91
# @clerk/clerk-react
npm i @clerk/clerk-react@4.26.1-snapshot.e37df91
# @clerk/remix
npm i @clerk/remix@3.0.3-snapshot.e37df91

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

!snapshot

@clerk-cookie

Copy link
Copy Markdown
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/chrome-extension@0.4.4-snapshot.aae1150
# @clerk/clerk-js
npm i @clerk/clerk-js@4.59.1-snapshot.aae1150
# @clerk/clerk-expo
npm i @clerk/clerk-expo@0.19.6-snapshot.aae1150
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.4.12-snapshot.aae1150
# @clerk/nextjs
npm i @clerk/nextjs@4.25.1-snapshot.aae1150
# @clerk/clerk-react
npm i @clerk/clerk-react@4.26.1-snapshot.aae1150
# @clerk/remix
npm i @clerk/remix@3.0.3-snapshot.aae1150

@nikosdouvlis

Copy link
Copy Markdown
Member Author

!snapshot

@clerk-cookie

Copy link
Copy Markdown
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/backend@0.30.1-snapshot.cecf74d
# @clerk/chrome-extension
npm i @clerk/chrome-extension@0.4.4-snapshot.cecf74d
# @clerk/clerk-js
npm i @clerk/clerk-js@4.59.1-snapshot.cecf74d
# @clerk/clerk-expo
npm i @clerk/clerk-expo@0.19.6-snapshot.cecf74d
# @clerk/fastify
npm i @clerk/fastify@0.6.11-snapshot.cecf74d
# gatsby-plugin-clerk
npm i gatsby-plugin-clerk@4.4.12-snapshot.cecf74d
# @clerk/nextjs
npm i @clerk/nextjs@4.25.1-snapshot.cecf74d
# @clerk/clerk-react
npm i @clerk/clerk-react@4.26.1-snapshot.cecf74d
# @clerk/remix
npm i @clerk/remix@3.0.3-snapshot.cecf74d
# @clerk/clerk-sdk-node
npm i @clerk/clerk-sdk-node@4.12.10-snapshot.cecf74d
# @clerk/shared
npm i @clerk/shared@0.24.1-snapshot.cecf74d

@OwenVey

OwenVey commented Oct 5, 2023

Copy link
Copy Markdown

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

 ⨯ node_modules/.pnpm/@clerk+shared@0.24.2_react@18.2.0/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
Copy Markdown
Member Author

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

@royanger

royanger commented Oct 5, 2023

Copy link
Copy Markdown
Member

@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

OwenVey commented Oct 5, 2023

Copy link
Copy Markdown

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