adrianhajdin / ai_saas_app

Build a REAL Software-as-a-Service app with AI features and payments & credits system that you might even turn into a side income or business idea using Next.js 14, Clerk, MongoDB, Cloudinary AI, and Stripe.
https://jsmastery.pro
1.07k stars 337 forks source link

MongoDB and clerk web hook error #15

Open jerrymjw opened 6 months ago

jerrymjw commented 6 months ago

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.

Manubenakal commented 6 months ago

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

jezbravo commented 6 months ago

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

iyashjayesh commented 5 months ago

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

This worked for me, thanks!

hflournoy commented 5 months ago

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

Teegreat commented 5 months ago

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
yashchavda0 commented 4 months ago

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

Teegreat commented 4 months ago

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.

jezbravo commented 4 months ago

@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.

yashchavda0 commented 4 months ago

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.

mmnsrti commented 4 months ago

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 ?

mmnsrti commented 4 months ago

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

NoelLincoln commented 4 months ago

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

yashchavda0 commented 4 months ago

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!!

saketsanadhya commented 3 months ago

i am getting user not found

umarfarzan commented 3 months ago

i have the same issue someone assist, shows failed

mmnsrti commented 3 months ago

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

mmnsrti commented 3 months ago

i am getting user not found

give more information

lightcompass commented 3 months ago

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,
  },
baradev commented 3 months ago

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. :)

rossman22590 commented 3 months ago

getting user not found

rossman22590 commented 3 months ago

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?

Sageikot001 commented 2 months ago

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.

ShadowAdi commented 2 months ago

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

Legit-Sam commented 1 month ago

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