medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
25.03k stars 2.5k forks source link

Unable to Build the Medusa 2.0.0-rc.4 Storefront Starter #9574

Open ShaunXenonKhan opened 6 days ago

ShaunXenonKhan commented 6 days ago

Bug report

Describe the bug

I am cannot build the Next.js storefront starter included with a clean installation of Medusa. Running yarn build from within the storefront folder fails due to type errors. The first error is as follows:

┌──(shaun@zeus)-[~/repos/lab/medusa/lab-medusa-v200rc4-storefront]
└─$yarn build
yarn run v1.22.22
$ next build
▲ Next.js 14.2.15
- Environments: .env.local

Creating an optimized production build ...
✓ Compiled successfully

./src/modules/checkout/components/shipping-address/index.tsx
71:6  Warning: React Hook useEffect has a missing dependency: 'customer.email'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
Linting and checking validity of types  ...Failed to compile.

./src/lib/data/customer.ts:58:18
Type error: Argument of type 'string | { location: string; }' is not assignable to parameter of type 'string'.
Type '{ location: string; }' is not assignable to type 'string'.

  56 |     })
  57 |
> 58 |     setAuthToken(loginToken)
     |                  ^
  59 |
  60 |     revalidateTag("customer")
  61 |     return createdCustomer
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I can modify line 58 to setAuthToken(loginToken as string) as a workaround. If I do this, the build fails on a subsequent type error.

System information

Medusa version (including plugins): 2.0.0-rc.4 with no plugins Node.js version: 21.2.0 Database: PostgreSQL 16.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit Operating system: Kubuntu 24.04 Browser (if relevant):

Steps to reproduce the behavior

  1. Install Medusa v2.0.0-rc.4 with storefront npx create-medusa-app@rc
  2. Start Medusa backend with yarn start
  3. Build Medusa Next.js starter project with yarn build
  4. See error

Expected behavior

Storefront build to complete without any issues.

ShaunXenonKhan commented 3 days ago

This issue persists up to v2.0.0-rc.6 for me. I have performed a clean installation of v2.0.0-rc.6 and cannot build a production storefront using the installed starter.

Is this related to my environment? Has anyone else hit this issue yet? Cheers.

olivermrbl commented 3 days ago

Thanks for the report, we are on it!