vercel / commerce

Next.js Commerce
https://demo.vercel.store
MIT License
11.55k stars 4.27k forks source link

Commerce.js wishlist missing, login & register form do not work #634

Closed wlaj closed 1 year ago

wlaj commented 2 years ago

Steps to reproduce

  1. Navigate to https://commercejs.vercel.store/

See Commerce.js demo header missing wishlist chrome_YzYFGKCMLd

Bigcommerce demo header containing wishlist chrome_nu54wThQFZ

Login and register form do not seem to respond to the input, nor login the user.

After installing, running and setting up the project locally, the same issue seems to appear. Everything else looks to be working as normal.

robbieaverill commented 2 years ago

Hi @wlaj, Commerce.js does not support a wishlist so this feature will not be implemented in this repository. You can use Next.js API routes and some kind of database to create your own equivalent.

cpv123 commented 2 years ago

@wlaj the login flow is not very clear, but I think it should work.

The first thing to note is that you can only log in using an email address that is already registered as a customer, meaning you must first create an order using the email address (which then creates the customer record). @robbieaverill correct me if this is wrong, but the login email can only be sent to email addresses that already exist as "customers"?

After this, you should be able to submit the login form leaving the password field empty. You will then receive an email that contains a login URL (see screenshot). Clicking this URL should then redirect you back to the site and you will be logged in. However, this repo current does not contain logic for fetching the orders for authenticated customers, so even once you are logged in there is not much that can be seen.

Screenshot 2565-01-24 at 21 15 51
cpv123 commented 2 years ago

Update - the login link does not work and instead takes me to a "not found" page which means the login API route is not working as expected. I will look into this and get it fixed.

@robbieaverill @wlaj

GodwinEbikwo commented 2 years ago

Any update @cpv123 ??

robbieaverill commented 2 years ago

@robbieaverill correct me if this is wrong, but the login email can only be sent to email addresses that already exist as "customers"?

Correct

cpv123 commented 2 years ago

Small update here, but no fix unfortunately.

The login flow works when running locally, but doesn't work at the deployed site https://commercejs.vercel.store/. Here, the login link that gets email ends up going to a 500 error page. But without accessing the Vercel dashboard where it's deployed.

cpv123 commented 2 years ago

I've deployed my own version to Vercel and now I also get the 500 error. The full error log is

[GET] /api/login/a2d6e9c5-874b-4c43-938b-7a7feb7e196c
17:23:19:69
2022-02-21T10:23:19.879Z    beda8155-3c48-4e53-aa52-dda273994368    ERROR   Error: Cannot find module 'react/jsx-runtime'
Require stack:
- /var/task/site/.next/server/pages/_document.js
- /var/task/node_modules/next/dist/server/require.js
- /var/task/node_modules/next/dist/server/load-components.js
- /var/task/node_modules/next/dist/server/base-server.js
- /var/task/node_modules/next/dist/server/next-server.js
- /var/task/___next_launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.997 (/var/task/site/.next/server/pages/_document.js:1041:18)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at Object.2565 (/var/task/site/.next/server/pages/_document.js:947:75)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/var/task/site/.next/server/pages/_document.js:1051:39)
    at /var/task/site/.next/server/pages/_document.js:1052:66 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/site/.next/server/pages/_document.js',
    '/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/load-components.js',
    '/var/task/node_modules/next/dist/server/base-server.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/___next_launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}

It seems that the login API route is trying to find react/jsx-runtime which is odd. And again, the error is only happening on Vercel - when running locally it works fine.

The code for this API route is at https://github.com/vercel/commerce/blob/main/packages/commercejs/src/api/endpoints/login/login.ts

Possibly the issue is related to the necessary next.config override that is required to make this API route work: https://github.com/vercel/commerce/blob/main/packages/commercejs/src/next.config.cjs

Hoping that @okbel @lfades @dominiksipowicz @gbibeaul might know what's causing this 🙏

guibovo commented 2 years ago

+1 on @cpv123 latest comment, just not on Login

[GET] /
11:18:44:78
2022-08-10T09:18:45.153Z    0ba4996e-7b50-4461-b49a-33da8ee47a2c    ERROR   Error: Cannot find module 'react/jsx-runtime'
Require stack:
- /var/task/site/.next/server/pages/_document.js
- /var/task/node_modules/next/dist/server/require.js
- /var/task/node_modules/next/dist/server/next-server.js
- /var/task/site/___next_launcher.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.997 (/var/task/site/.next/server/pages/_document.js:100:18)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at Object.9463 (/var/task/site/.next/server/pages/_document.js:15:75)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/var/task/site/.next/server/pages/_document.js:110:39)
    at /var/task/site/.next/server/pages/_document.js:111:70 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/site/.next/server/pages/_document.js',
    '/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/site/___next_launcher.cjs'
  ]
}
2022-08-10T09:18:45.154Z    0ba4996e-7b50-4461-b49a-33da8ee47a2c    ERROR   Error: Cannot find module 'react/jsx-runtime'
Require stack:
- /var/task/site/.next/server/pages/_document.js
- /var/task/node_modules/next/dist/server/require.js
- /var/task/node_modules/next/dist/server/next-server.js
- /var/task/site/___next_launcher.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.997 (/var/task/site/.next/server/pages/_document.js:100:18)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at Object.9463 (/var/task/site/.next/server/pages/_document.js:15:75)
    at __webpack_require__ (/var/task/site/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/var/task/site/.next/server/pages/_document.js:110:39)
    at /var/task/site/.next/server/pages/_document.js:111:70 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/site/.next/server/pages/_document.js',
    '/var/task/node_modules/next/dist/server/require.js',
    '/var/task/node_modules/next/dist/server/next-server.js',
    '/var/task/site/___next_launcher.cjs'
  ],
  page: '/'
}
RequestId: 0ba4996e-7b50-4461-b49a-33da8ee47a2c Error: Runtime exited without providing a reason
Runtime.ExitError
JimmyK1995 commented 2 years ago

Seems like you guys are working on the login errors. Is the missing wishlist up for grabs? Would love to help out.

leerob commented 1 year ago

Hey there! Thank you for opening this issue. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: https://github.com/vercel/commerce/pull/966