#clerk webhook error

52 messages · Page 1 of 1 (latest)

novel horizon
#

clerk webhook failed user.created and sending i am getting this errror while connecting clerk to mongodb via webhooks can anyone help me solve the error while developing js mastery AI SASS Project

green gale
#

I think we're having the same error

#

If you take a look at your vercel dashboard logs you should see whether the webhook was successfull there also, and you'll also see a message saying that the route is blocked by middleware -- atleast that's the issue in my case...

#

which leads me to the next problem, it seems that i'm already allowing the webhook:

import { authMiddleware } from '@clerk/nextjs';

export default authMiddleware({
  publicRoutes: ['/', '/api/webhooks/clerk', '/api/webhooks/stripe'],
});

export const config = {
  matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
};

I think my route structure is correct as well...

curious to see if you're having the same issues.

#

I think i found my issue in the logs looks like i misspelled webhooks:

vagrant wadi
#

hi i face this error too,
do u solve it ady?

#

this is my log

novel horizon
#

tell me if you find the solution

green gale
#

yea for me i spelled webhooks wrong when i entered the api url in the clerk dashboard — so clerk was hitting the wrong endpoint

green gale
#

and it gives instructions on how to unprotect it if you want.

vagrant wadi
#

i see

green gale
novel horizon
#

my url is right still getting an error

#

help me find the solution

green gale
#

can you share your vercel logs and a screenshot of both your clerk endpoint config and your file structure. Those are the things to rule out first.

novel horizon
#

okay wait a sec

green gale
#

np take your time

novel horizon
#

tell me the solution

green gale
#

that tells us that your clerk webhook url is correct.

#

In your case it looks like your mongodb connection string is not valid - did u add your password when you pasted the string into your .env.local?

#

let me know if that works

novel horizon
#

i'll just check and update you

#

i have added the password but still not working

green gale
#

did u restart the dev server? also check the vercel logs again and see if there are any additional errors

#

One of the errors in your logs above also says your mongodb string doesnt start properly

#

Does that still show up after u added the password?

novel horizon
#

yes i restarted th dev means i tried after sometime still getiing that error

green gale
#

what do your vercel logs say?

novel horizon
#

wait i'' share it

green gale
#

cool and did u double check the connection string it says it should start with mongodb://

novel horizon
#

see this

#

this is string of mongo db

green gale
#

not sure if this matters but mine has an appName appended to the end:

novel horizon
#

i have copied the url itself from mongdb website

green gale
#

thats the only difference I can see

novel horizon
#

i''' check with the new url and will update you

novel horizon
#

Error gone with new url thanks Gaurang

gentle holly
#

I’m having issues with the user data saving in my mongo db database

#

I’ve added the my db uri to the env, the event category saves but user data doesn’t

#

I aslo have this error after trying to create an event
ERROR

POST https://e-sync.vercel.app/events/create 500 (Internal Server Error)
333-51d75ad37095335f.js:1 Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.

Note: this is my vercel production url https://e-sync.vercel.app/

green gale
gentle holly
#

This error shows when i try to create an event

green gale
#

yea i thunk youre a bit farther along than we were…

#

will let u know when i come across it in the video

gentle holly
#

In my debugging i found out that if the user data is not in the mongo db I can’t create an event

green gale
#

yea Im not sure cus I havent gotten that far, but if an event belongs to a user, then that would make sense.

gentle holly
green gale
#

Which project is this for? Is this for the AI Saas app?

gentle holly
#

noo the event project Js Mastery posted