javascript icon indicating copy to clipboard operation
javascript copied to clipboard

> 4.2.1 - Redwood JS API Server throws error

Open ariperez opened this issue 3 years ago • 2 comments

  • [x] Review the documentation: https://docs.clerk.dev/
  • [x] Search for existing issues: https://github.com/clerkinc/javascript/issues
  • [x] Go through package changelog files.
  • [ ] Provide the Frontend API key from your application dashboard.

Package + Version

  • [ ] @clerk/clerk-js
  • [ ] @clerk/clerk-react
  • [ ] @clerk/nextjs
  • [ ] @clerk/remix
  • [ ] @clerk/types
  • [ ] @clerk/themes
  • [ ] @clerk/clerk-expo
  • [ ] @clerk/backend-core
  • [x] @clerk/clerk-sdk-node
  • [ ] @clerk/edge
  • [ ] other:

Version:

> 4.2.1

Browser/OS

API Backend only

Description

When using the latest Redwood JS, getting the following error:

api | 11:03:09 🚨 graphql-server Error building context. Error: Exception in getAuthenticationContext: Cannot find module './dist/instance'
api | Require stack:
api | - /Users/ariperez/github/beacon-redwood/node_modules/@clerk/clerk-sdk-node/instance.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api/dist/auth/decoders/clerk.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api/dist/auth/decoders/index.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api/dist/auth/index.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api/dist/index.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/graphql-server/dist/functions/graphql.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/graphql-server/dist/index.js
api | - /Users/ariperez/github/beacon-redwood/api/dist/functions/graphql.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api-server/dist/plugins/lambdaLoader.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api-server/dist/plugins/withFunctions.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api-server/dist/cliHandlers.js
api | - /Users/ariperez/github/beacon-redwood/node_modules/@redwoodjs/api-server/dist/index.js

ariperez avatar Oct 14 '22 15:10 ariperez

Thanks for reporting. This is a known issue that we will fix ASAP.

Meanwhile, you can try the following:

const Clerk = require('@clerk/clerk-sdk-node/cjs/instance').default

Or

const { createClerkClient } = require("@clerk/clerk-sdk-node");

const clerk = createClerkClient({
  apiKey: process.env.CLERK_API_KEY,
});

const users = await clerk.users.getUserList();

...

SokratisVidros avatar Oct 14 '22 15:10 SokratisVidros

Thanks for reporting. This is a known issue that we will fix ASAP.

Meanwhile, you can try the following:

const Clerk = require('@clerk/clerk-sdk-node/cjs/instance').default

Or

const { createClerkClient } = require("@clerk/clerk-sdk-node");

const clerk = createClerkClient({
  apiKey: process.env.CLERK_API_KEY,
});

const users = await clerk.users.getUserList();

...

Thanks!

ariperez avatar Oct 17 '22 14:10 ariperez

This should be fixed by https://github.com/redwoodjs/redwood/pull/6685

SokratisVidros avatar Oct 28 '22 20:10 SokratisVidros