clerk / javascript

Official JavaScript repository for Clerk authentication
https://clerk.com
MIT License
1.14k stars 260 forks source link

Bug: suspected bug. clerk.users.createUser(CreateUserParams) not working. #1460

Closed lucidfxai closed 1 year ago

lucidfxai commented 1 year ago

clerk.users.createUser(CreateUserParams) not working.

clerk.users.getUserList works fine. but not the above^^

● Making real requests to the Clerk API › should call insertUser on "user.created" event

Unprocessable Entity

  at ve.request (node_modules/.pnpm/@clerk+backend@0.24.0/node_modules/@clerk/backend/src/api/request.ts:69:7)

Test Suites: 1 failed, 1 passed, 2 total Tests: 1 failed, 10 passed, 11 total Snapshots: 0 total Time: 3.079 s Ran all test suites.  ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Test failed. See above for more details.      --------------------------------------------------------------------------------------      import clerk from '@clerk/clerk-sdk-node';    describe('Making real requests to the Clerk API', () => { let req: Partial; let res: Partial; let userId: string;

beforeEach(async () => { // Create a new user console.log('create user', await clerk.users.createUser({ emailAddress: ['test@example.com'], firstName: 'Test', lastName: 'User' })); }); it('should call insertUser on "user.created" event', async () => { req.body.type = { type: 'user.created', data: { id: userId }, };

await handler(req as NextApiRequest, res as NextApiResponse);

expect(insertUser).toHaveBeenCalledWith({ user_id: userId });
expect(res.status).toHaveBeenCalledWith(200);
expect(res.json).toHaveBeenCalledWith({ message: 'Event received' });

}); });

"dependencies": { "@clerk/clerk-sdk-node": "^4.10.15", "@clerk/nextjs": "^4.21.13", "@tanstack/react-query": "^4.18.0", "@trpc/client": "^10.32.0", "@trpc/next": "^10.32.0", "@trpc/server": "^10.32.0", "@types/node": "20.3.1", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", "autoprefixer": "10.4.14", "dotenv": "^16.3.1", "drizzle-orm": "^0.27.0", "drizzle-zod": "^0.4.4", "eslint": "8.43.0", "eslint-config-next": "13.4.7", "mysql2": "^3.4.2", "next": "13.4.7", "postcss": "8.4.24", "react": "18.2.0", "react-dom": "18.2.0", "superjson": "^1.12.4", "svix": "^1.5.2", "tailwindcss": "3.3.2", "url": "^0.11.1", "zod": "^3.0.0" }, "devDependencies": { "@types/jest": "^29.5.2", "@types/node": "^18.16.16", "@types/react": "^18.2.8", "@types/react-dom": "^18.2.4", "@types/supertest": "^2.0.12", "drizzle-kit": "^0.19.2", "eslint": "^8.40.0", "jest": "^29.5.0", "ngrok": "5.0.0-beta.2", "supertest": "^6.3.3", "ts-jest": "^29.1.0", "ts-node": "^10.9.1", "typescript": "5.1.3" } }

dimkl commented 1 year ago

Hello @lucidfxai Could you provide the response body of the Unprocessable Entity error?

clerk-cookie commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

clerk-cookie commented 1 year ago

This issue was closed because it has been stalled for 10 days with no activity.

clerk-cookie commented 2 months ago

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