Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy frontend part to vercel failed #4060

Closed
rico-c opened this issue May 10, 2023 · 7 comments
Closed

Deploy frontend part to vercel failed #4060

rico-c opened this issue May 10, 2023 · 7 comments

Comments

@rico-c
Copy link

rico-c commented May 10, 2023

Bug report

Describe the bug

I just trying to deploy the original code to vercel , and I got the following error from vercel's deployment

Failed to compile.
--
09:25:55.045 |  
09:25:55.046 | ./src/lib/data/index.ts:20:3
09:25:55.046 | Type error: Type 'PricedProduct[] \| never[]' is not assignable to type 'Product[]'.
09:25:55.046 | Type 'PricedProduct[]' is not assignable to type 'Product[]'.
09:25:55.046 | Property 'beforeInsert' is missing in type 'PricedProduct' but required in type 'Product'.
09:25:55.046 |  
09:25:55.046 | 18 \|     .catch((_) => [])
09:25:55.046 | 19 \|
09:25:55.046 | > 20 \|   return products
09:25:55.046 | \|   ^
09:25:55.046 | 21 \| }
09:25:55.046 | 22 \|
09:25:55.046 | 23 \| // get global data used in header and footer
09:25:55.095 | error Command failed with exit code 1.

System information

Medusa version (including plugins): current lasted version 1.3.7
Node.js version: vercel
Database: none
Operating system: vercel
Browser (if relevant):

Screenshots

image

@TOPAiiN
Copy link

TOPAiiN commented May 10, 2023

I am having the same issue and when I am able to make that file work, it continues breaking another one. Actually, if you try to build the storefront it will crash.

 storefront git:(main) npm run build

> medusa-next@1.0.3 build
> next build

next.config.js {
  "reactStrictMode": true,
  "images": {
    "domains": [
      "medusa-public-images.s3.eu-west-1.amazonaws.com",
      "localhost"
    ]
  },
  "env": {}
}
info  - Linting and checking validity of types .Failed to compile.

./src/lib/data/index.ts:20:3
Type error: Type 'PricedProduct[] | never[]' is not assignable to type 'Product[]'.
  Type 'PricedProduct[]' is not assignable to type 'Product[]'.
    Property 'beforeInsert' is missing in type 'PricedProduct' but required in type 'Product'.

  18 |     .catch((_) => [])
  19 | 
> 20 |   return products
     |   ^
  21 | }
  22 | 
  23 | // get global data used in header and footer

@vincenzo
Copy link

Just stopping by to say I am experiencing the same thing. All works fine in 'dev mode'.

@gamesguru
Copy link

@pevey
I get the same error. Is there a workaround, or any fix for this? Maybe suppress lint?

When running the build on the same machine hosting my API, i get a little further, but a similar error.

$ npx next build
info  - Loaded env from /home/gg/store/storefront/.env
next.config.js {
  "reactStrictMode": true,
  "images": {
    "domains": [
      "medusa-public-images.s3.eu-west-1.amazonaws.com",
      "localhost"
    ]
  },
  "env": {}
}
info  - Linting and checking validity of types .Failed to compile.

./src/lib/context/checkout-context.tsx:246:25
Type error: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.

  244 | 
  245 |     if (shippingMethods) {
> 246 |       setShippingOption(shippingMethods[0].value)
      |                         ^
  247 |     }
  248 |   }
  249 | 

@pevey
Copy link
Contributor

pevey commented May 13, 2023

@gamesguru I'm sorry, I don't use the nextjs frontend, and I don't use Vercel. I can't be of any help on this one.

@gamesguru
Copy link

@pevey Do you know anyone who might be able to help? Since this is a production issue affecting multiple users, hopefully we could get a diagnosis next week.

@gamesguru
Copy link

I'm able to bypass the next type checking with this.

https://stackoverflow.com/questions/71296393/disable-typescript-from-checking-types-validity-when-building-for-production

The app runs much slower in dev mode, so this is a welcome performance boost. Hopefully we can get a full fix soon!

@olivermrbl
Copy link
Contributor

The Next.js Storefront starter is due for an extensive upgrade, but these issues should be solved now. Please pull the latest changes from the repository and try again. Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants