SrijanShovit / carbonops-v2

https://carbonops-v2.vercel.app
MIT License
19 stars 46 forks source link

Signup login backend #194

Closed AlfiyaSiddique closed 1 year ago

AlfiyaSiddique commented 1 year ago

Related Issue

Closes: #168

Description of Changes

Added functions createUser, and findUserByemail in the backend to create a user Added a database model named allUser Added credentials provider in nextAuth route Added routes for after signup and login

Checklist:

Sample Video

https://github.com/SrijanShovit/carbonops-v2/assets/86224794/3a2fb603-c517-4c6d-b561-96b5683f902d

Note

You need to add the backend server URL in the backendInfo.js file

vercel[bot] commented 1 year ago

Someone is attempting to deploy a commit to a Personal Account owned by @SrijanShovit on Vercel.

@SrijanShovit first needs to authorize it.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
carbonops-v2 ❌ Failed (Inspect) Jul 12, 2023 4:20am
AlfiyaSiddique commented 1 year ago

Hello @shreya024

I resolve the merge conflicts. I am not able to see what errors are occurring in Vercel so can you please guide me with that . And also I have mentioned earlier that to make a backend request successful I need the deployed backend server link in the URL.js file, so possibly this part causing the error.

Please guide me with this.

AlfiyaSiddique commented 1 year ago

@shreya024 please guide me with vercel errors I am unable to see what are the vercel errors that occur.

SrijanShovit commented 1 year ago

vercel error log on deployment @shreya024

[09:48:22.726] Running build in San Francisco, USA (West) – sfo1 [09:48:22.793] Cloning github.com/SrijanShovit/carbonops-v2 (Branch: signup-login-backend, Commit: 22fe880) [09:48:23.770] Cloning completed: 977.004ms [09:48:29.770] Skipping build cache since Package Manager changed from "npm" to "yarn" [09:48:34.501] Running "vercel build" [09:48:35.158] Vercel CLI 31.0.1 [09:48:35.532] Installing dependencies... [09:48:35.892] yarn install v1.22.17 [09:48:35.977] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [09:48:35.981] [1/4] Resolving packages... [09:48:37.316] [2/4] Fetching packages... [09:49:34.074] [3/4] Linking dependencies... [09:49:34.079] warning " > bootstrap@5.3.0" has unmet peer dependency "@popperjs/core@^2.11.7". [09:49:34.080] warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react@^18.0.9". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react-dom@^18.0.3". [09:49:34.082] warning " > styled-components@5.3.11" has unmet peer dependency "react-is@>= 16.8.0". [09:50:10.433] [4/4] Building fresh packages... [09:50:11.641] success Saved lockfile. [09:50:11.648] Done in 95.76s. [09:50:11.695] Detected Next.js version: 13.4.6 [09:50:11.704] Running "yarn run build" [09:50:11.956] yarn run v1.22.17 [09:50:11.996] $ next build [09:50:12.594] Attention: Next.js now collects completely anonymous telemetry regarding usage. [09:50:12.595] This information is used to shape Next.js' roadmap and prioritize features. [09:50:12.595] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: [09:50:12.595] https://nextjs.org/telemetry [09:50:12.596] [09:50:12.723] - info Creating an optimized production build... [09:50:32.699] Failed to compile. [09:50:32.699] [09:50:32.699] ./backend/config/db.config.js [09:50:32.699] Module not found: Can't resolve 'mongoose' [09:50:32.699] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.700] Import trace for requested module: [09:50:32.700] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.700] [09:50:32.700] ./backend/models/allUsers.js [09:50:32.700] Module not found: Can't resolve 'mongoose' [09:50:32.700] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.701] Import trace for requested module: [09:50:32.701] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.701] [09:50:32.701] [09:50:32.701] > Build failed because of webpack errors [09:50:32.856] error Command failed with exit code 1. [09:50:32.856] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [09:50:32.882] Error: Command "yarn run build" exited with 1

AlfiyaSiddique commented 1 year ago

vercel error log on deployment @shreya024

[09:48:22.726] Running build in San Francisco, USA (West) – sfo1 [09:48:22.793] Cloning github.com/SrijanShovit/carbonops-v2 (Branch: signup-login-backend, Commit: 22fe880) [09:48:23.770] Cloning completed: 977.004ms [09:48:29.770] Skipping build cache since Package Manager changed from "npm" to "yarn" [09:48:34.501] Running "vercel build" [09:48:35.158] Vercel CLI 31.0.1 [09:48:35.532] Installing dependencies... [09:48:35.892] yarn install v1.22.17 [09:48:35.977] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [09:48:35.981] [1/4] Resolving packages... [09:48:37.316] [2/4] Fetching packages... [09:49:34.074] [3/4] Linking dependencies... [09:49:34.079] warning " > bootstrap@5.3.0" has unmet peer dependency "@popperjs/core@^2.11.7". [09:49:34.080] warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react@^18.0.9". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react-dom@^18.0.3". [09:49:34.082] warning " > styled-components@5.3.11" has unmet peer dependency "react-is@>= 16.8.0". [09:50:10.433] [4/4] Building fresh packages... [09:50:11.641] success Saved lockfile. [09:50:11.648] Done in 95.76s. [09:50:11.695] Detected Next.js version: 13.4.6 [09:50:11.704] Running "yarn run build" [09:50:11.956] yarn run v1.22.17 [09:50:11.996] $ next build [09:50:12.594] Attention: Next.js now collects completely anonymous telemetry regarding usage. [09:50:12.595] This information is used to shape Next.js' roadmap and prioritize features. [09:50:12.595] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: [09:50:12.595] https://nextjs.org/telemetry [09:50:12.596] [09:50:12.723] - info Creating an optimized production build... [09:50:32.699] Failed to compile. [09:50:32.699] [09:50:32.699] ./backend/config/db.config.js [09:50:32.699] Module not found: Can't resolve 'mongoose' [09:50:32.699] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.700] Import trace for requested module: [09:50:32.700] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.700] [09:50:32.700] ./backend/models/allUsers.js [09:50:32.700] Module not found: Can't resolve 'mongoose' [09:50:32.700] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.701] Import trace for requested module: [09:50:32.701] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.701] [09:50:32.701] [09:50:32.701] > Build failed because of webpack errors [09:50:32.856] error Command failed with exit code 1. [09:50:32.856] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [09:50:32.882] Error: Command "yarn run build" exited with 1

@shreya024 and @SrijanShovit

From the logs, I understood that there are two errors in the nextAuth router file and both are saying that the module is not found because I have imported them from the backend folder.

The errors are occurring possibly because the backend folder is hosted on some other URL. If that is so, then can you please provide me the backend URL so that I can make the required changes in the code.

And If I am wrong then Please guide me about what I have to do on my side to fix these errors.

shreya024 commented 1 year ago

vercel error log on deployment @shreya024 [09:48:22.726] Running build in San Francisco, USA (West) – sfo1 [09:48:22.793] Cloning github.com/SrijanShovit/carbonops-v2 (Branch: signup-login-backend, Commit: 22fe880) [09:48:23.770] Cloning completed: 977.004ms [09:48:29.770] Skipping build cache since Package Manager changed from "npm" to "yarn" [09:48:34.501] Running "vercel build" [09:48:35.158] Vercel CLI 31.0.1 [09:48:35.532] Installing dependencies... [09:48:35.892] yarn install v1.22.17 [09:48:35.977] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [09:48:35.981] [1/4] Resolving packages... [09:48:37.316] [2/4] Fetching packages... [09:49:34.074] [3/4] Linking dependencies... [09:49:34.079] warning " > bootstrap@5.3.0" has unmet peer dependency "@popperjs/core@^2.11.7". [09:49:34.080] warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react@^18.0.9". [09:49:34.081] warning " > mdb-react-ui-kit@6.1.0" has unmet peer dependency "@types/react-dom@^18.0.3". [09:49:34.082] warning " > styled-components@5.3.11" has unmet peer dependency "react-is@>= 16.8.0". [09:50:10.433] [4/4] Building fresh packages... [09:50:11.641] success Saved lockfile. [09:50:11.648] Done in 95.76s. [09:50:11.695] Detected Next.js version: 13.4.6 [09:50:11.704] Running "yarn run build" [09:50:11.956] yarn run v1.22.17 [09:50:11.996] $ next build [09:50:12.594] Attention: Next.js now collects completely anonymous telemetry regarding usage. [09:50:12.595] This information is used to shape Next.js' roadmap and prioritize features. [09:50:12.595] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: [09:50:12.595] https://nextjs.org/telemetry [09:50:12.596] [09:50:12.723] - info Creating an optimized production build... [09:50:32.699] Failed to compile. [09:50:32.699] [09:50:32.699] ./backend/config/db.config.js [09:50:32.699] Module not found: Can't resolve 'mongoose' [09:50:32.699] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.700] Import trace for requested module: [09:50:32.700] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.700] [09:50:32.700] ./backend/models/allUsers.js [09:50:32.700] Module not found: Can't resolve 'mongoose' [09:50:32.700] [09:50:32.700] https://nextjs.org/docs/messages/module-not-found [09:50:32.700] [09:50:32.701] Import trace for requested module: [09:50:32.701] ./src/app/api/auth/[...nextauth]/route.js [09:50:32.701] [09:50:32.701] [09:50:32.701] > Build failed because of webpack errors [09:50:32.856] error Command failed with exit code 1. [09:50:32.856] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [09:50:32.882] Error: Command "yarn run build" exited with 1

@shreya024 and @SrijanShovit

From the logs, I understood that there are two errors in the nextAuth router file and both are saying that the module is not found because I have imported them from the backend folder.

The errors are occurring possibly because the backend folder is hosted on some other URL. If that is so, then can you please provide me the backend URL so that I can make the required changes in the code.

And If I am wrong then Please guide me about what I have to do on my side to fix these errors.

@AlfiyaSiddique Take a pull and try doing npm i mongoose

AlfiyaSiddique commented 1 year ago

@shreya024 Do I have to do npm i mongoose outside the backend folder?? Because in the backend folder, the Mongoose package already exists?

shreya024 commented 1 year ago

@shreya024 Do I have to do npm i mongoose outside the backend folder?? Because in the backend folder, the Mongoose package already exists?

@AlfiyaSiddique Yes it will solve the vercel error

AlfiyaSiddique commented 1 year ago

@shreya024 added the mongoose package

AlfiyaSiddique commented 1 year ago

@SrijanShovit can you please review it!!

shreya024 commented 1 year ago

@AlfiyaSiddique Resolve the merge conflicts

AlfiyaSiddique commented 1 year ago

@AlfiyaSiddique Resolve the merge conflicts

@shreya024 Resolved. 👍🏻