adrianhajdin/ai_saas_app

MongoDB and clerk web hook error

Opened this issue ยท 24 comments

I found when I connect to webhook, clerk shows some error and mongoDB shows the data not come frome my data model. I don't know where it comes from.
mongoDB data error
model

clerk error

I'd appreciated if you can give me some feedback.

Could you provide some more context and those are sample data in mongoDB.

Hello, try this:
Go to your project in Vercel > Settings > Deployment Protection and set Vercel Authentication: Disabled.

Hello, try this: Go to your project in Vercel > Settings > Deployment Protection and set Vercel Authentication: Disabled.

This worked for me, thanks!

@iyashjayesh this didn't work for me, did you do anything else to resolve this?

The issue is coming from MongoDB as the application cannot access the database based on the IP address captured during the setup process of your DB. To fix this issue;

  1. Login to MongoDB
  2. Navigate to the Network Access Tab
  3. Delete all IP addresses listed
  4. Click on Add IP Addresses >> Add your current IP address
  5. Again, click on Add IP Addresses, this time you are to allow access from anywhere by simply typing this: 0.0.0.0/0

The issue is coming from MongoDB as the application cannot access the database based on the IP address captured during the setup process of your DB. To fix this issue;

  1. Login to MongoDB
  2. Navigate to the Network Access Tab
  3. Delete all IP addresses listed
  4. Click on Add IP Addresses >> Add your current IP address
  5. Again, click on Add IP Addresses, this time you are to allow access from anywhere by simply typing this: 0.0.0.0/0

It won`t work. As there is no Problem with the connection to mongoDB

The issue is coming from MongoDB as the application cannot access the database based on the IP address captured during the setup process of your DB. To fix this issue;

  1. Login to MongoDB
  2. Navigate to the Network Access Tab
  3. Delete all IP addresses listed
  4. Click on Add IP Addresses >> Add your current IP address
  5. Again, click on Add IP Addresses, this time you are to allow access from anywhere by simply typing this: 0.0.0.0/0

It won`t work. As there is no Problem with the connection to mongoDB

Have you tried it or you're just saying?

I'm telling you what worked for me.

@iyashjayesh this didn't work for me, did you do anything else to resolve this?

Hello. If the problem is not with the connection to the database, you can try to delete the entire collection from the Mongo DB page and create it again from the code execution.

The issue is coming from MongoDB as the application cannot access the database based on the IP address captured during the setup process of your DB. To fix this issue;

  1. Login to MongoDB
  2. Navigate to the Network Access Tab
  3. Delete all IP addresses listed
  4. Click on Add IP Addresses >> Add your current IP address
  5. Again, click on Add IP Addresses, this time you are to allow access from anywhere by simply typing this: 0.0.0.0/0

It won`t work. As there is no Problem with the connection to mongoDB

Have you tried it or you're just saying?

I'm telling you what worked for me.

I tried.
even I made the whole Database once again still same problem occured.

its also gives me the same error in clerk dashboad and ive tried the mongodb access all ip method and the vercel method to Deployment Protection and set Vercel Authentication: Disabled. . what should i do to fix this error ?

i found the solution
in the change the usename to userName declare type CreateUserParams = { clerkId: string; email: string; userName: string; firstName: string; lastName: string; photo: string; };
and also in clerk route.ts change the usename to userName const user = { clerkId: id, email: email_addresses[0].email_address, userName: username!, firstName: first_name, lastName: last_name, photo: image_url, }; do this and it will work as intended

i found the solution in the change the usename to userName declare type CreateUserParams = { clerkId: string; email: string; userName: string; firstName: string; lastName: string; photo: string; }; and also in clerk route.ts change the usename to userName const user = { clerkId: id, email: email_addresses[0].email_address, userName: username!, firstName: first_name, lastName: last_name, photo: image_url, }; do this and it will work as intended

Hi @mmnsrti , I need your help please. I am stuck on this issue. I have tried everything. Thank you in advance

i found the solution in the change the usename to userName declare type CreateUserParams = { clerkId: string; email: string; userName: string; firstName: string; lastName: string; photo: string; }; and also in clerk route.ts change the usename to userName const user = { clerkId: id, email: email_addresses[0].email_address, userName: username!, firstName: first_name, lastName: last_name, photo: image_url, }; do this and it will work as intended

Tried, but not working!!

i am getting user not found

i have the same issue someone assist, shows failed

i found the solution in the change the usename to userName declare type CreateUserParams = { clerkId: string; email: string; userName: string; firstName: string; lastName: string; photo: string; }; and also in clerk route.ts change the usename to userName const user = { clerkId: id, email: email_addresses[0].email_address, userName: username!, firstName: first_name, lastName: last_name, photo: image_url, }; do this and it will work as intended

u can clone my repo and compare youor code to mine . if you couldnt make it right email me

i am getting user not found

give more information

Hi, I encountered the same, but after debugging, I found the response from the clerk over Google Oauth is changed, there is no "username" and "photo" attribute.

at the codebase please look at the user model, it requires these 2 attributes to create a user.

my hotfix is to remove the "require" attribute, so my user.model.ts look like below

userName: {
    type: String,
  },
  photo: {
    type: String,
  },

Hi everyone, I spent a lot of time on the project, but everything works well now! Feel free to check my repo or reach out to me for help. :)

getting user not found

Hi everyone, I spent a lot of time on the project, but everything works well now! Feel free to check my repo or reach out to me for help. :)

can you help?

i found the solution in the change the usename to userName declare type CreateUserParams = { clerkId: string; email: string; userName: string; firstName: string; lastName: string; photo: string; }; and also in clerk route.ts change the usename to userName const user = { clerkId: id, email: email_addresses[0].email_address, userName: username!, firstName: first_name, lastName: last_name, photo: image_url, }; do this and it will work as intended

This didn't work and honestly it didn't make sense that it would, just had to try and it didn't.

I Tried Everything but still i got the same problem. I Changed my ip address and set Vercel Authentication: Disabled. Change the userId Thing but still not working. Does someone has any other solution

I found when I connect to webhook, clerk shows some error and mongoDB shows the data not come frome my data model. I don't know where it comes from. mongoDB data error model

clerk error

I'd appreciated if you can give me some feedback.

Pleasae can you share me your user.actions.ts file codes and also mongoose.ts codes please