project_next_14_ai_prompt_sharing icon indicating copy to clipboard operation
project_next_14_ai_prompt_sharing copied to clipboard

Can't conneted with the MongoDB backend

Open Pannu786 opened this issue 2 years ago • 14 comments

I have tried everything. Even looked into the other solved solutions but nothing seems to work for me,

Pannu786 avatar Oct 27 '23 17:10 Pannu786

What error exactly are you facing? Can you share the shots?

honxsinatra avatar Nov 08 '23 11:11 honxsinatra

What error exactly are you facing? Can you share the shots?

That's the thing I'm not getting any errors. all is working fine except for the backend. I am not able to see my data in cluster inside mongoDB.

Pannu786 avatar Nov 11 '23 09:11 Pannu786

What error exactly are you facing? Can you share the shots?

That's the thing I'm not getting any errors. all is working fine except for the backend. I am not able to see my data in cluster inside mongoDB.

can you share your route file in [...nextauth] folder? However make sure in your route file you are using "callbacks" and not "callback" and keep in mind that the match used in the video does not allow other user to sign in once their name have more than one space in between their name, to avoid the validation error make sure to change from "username: profile.name.replace(" ", "").toLowerCase()" to "username: profile.name.replace(/ /g, "").toLowerCase()" image

honxsinatra avatar Nov 14 '23 22:11 honxsinatra

correction Look around the red marked area

honxsinatra avatar Nov 14 '23 22:11 honxsinatra

Don't hesitate to ask further info once you won't understand or solve your bug.

What error exactly are you facing? Can you share the shots?

That's the thing I'm not getting any errors. all is working fine except for the backend. I am not able to see my data in cluster inside mongoDB.

honxsinatra avatar Nov 14 '23 22:11 honxsinatra

Don't hesitate to ask further info once you won't understand or solve your bug.

What error exactly are you facing? Can you share the shots?

That's the thing I'm not getting any errors. all is working fine except for the backend. I am not able to see my data in the cluster inside MongoDB.

Hey @honxsinatra . I hope you are doing great. I have tried exactly what you mentioned me above. Unfortunately, it doesn't seem to work for me. My main issue is my backend doesn't seem to connect with the frontend thus no user data is getting saved in the database maybe it has something to do with the cluster which I am not able to fix. My works fine without adding "s" on callback but when I added "s" it broke and told me "access dined". I have attached the file shots you asked for. Please have a look once you have time. I appreciate your help tho.

here the app is working all right without adding "s" but is not able to communicate with the backend and the user data is not stored in the mangoDB database. without callbacks

here app breaks down when adding "s" with a callback with callbacks

route file shot-1 route file-1

route file shot-2 route file-2

user file shot-1 user file-1

user file shot-2 user file-2

database file database file-1

I am aware .eve file should be kept secret lol but since this is not a real project I don't mind sharing it here .. env file

here is the cluster which seems to be created successfully and all but not getting any data in.. mangoDB is not connected

Pannu786 avatar Nov 29 '23 15:11 Pannu786

hello @Pannu786 , I am really sorry for the challenge you have faced, the problem of access denied is always coming from the username requirements, that's the username you are trying to sign in with does not meet therequirement of match so try the following match and replace it to your match from "user.js" file;

match: [ /^(?=[a-zA-Z0-9\s()]{6,25}$)(?![.])(?!.*[.]{2})[a-zA-Z0-9\s()]+(?<![_.])$/, "Username invalid, it should contain 6-25 alphanumeric letters and be unique!", ]

See the short below

image

honxsinatra avatar Nov 29 '23 17:11 honxsinatra

@Pannu786 The global match above allows any username to be valid. You can customize it, but the more you specify, the more usernames you exclude.

honxsinatra avatar Nov 29 '23 17:11 honxsinatra

Don't hesitate to reach me out if it won't work

honxsinatra avatar Nov 29 '23 17:11 honxsinatra

/^(?=[a-zA-Z0-9\s()]{6,25}$)(?![.])(?!.*[.]{2})[a-zA-Z0-9\s()]+(?<![_.])$/, "Username invalid, it should contain 6-25 alphanumeric letters and be unique!", ]

Sorry, but It still doesn't seem to work for me. When I remove "s" from the "callbacks" the app runs without any issues and I can sign in easily. I just want the mangoDB cluster to work and store the user data.

replace

Pannu786 avatar Nov 30 '23 01:11 Pannu786

any other tips you have that I should try? @honxsinatra

Pannu786 avatar Dec 04 '23 17:12 Pannu786

When you remove the 's' from 'callback', the code inside the sign-in function will not be executed. Therefore, you need to use 'callbacks' instead of 'callback'. However, to address your issue, please share the error you encounter when using 's'. Providing a screenshot would be greatly appreciated.

any other tips you have that I should try? @honxsinatra

honxsinatra avatar Dec 04 '23 18:12 honxsinatra

any other tips you have that I should try? @honxsinatra

Did you try removing <> this bracket from your password in mongodbUri i think bracket should not be included , also i am stuck in same situation where adding s to callback login works and cluster is not saving the login information

divyanshucode avatar Dec 20 '23 06:12 divyanshucode

@divyanshucode thanks alot bro i was stuck on for hrs , but finally this worked on lol.

Hemanth12-git avatar Jul 29 '24 12:07 Hemanth12-git