3

Firstly, there are some questions on SO with similar titles but I don't believe this is a duplicate as I thin it's a recent change to a package or vercel causing it.

I upgraded some packages in an app I'm building today..

Here are the packages which changed

  "dependencies": {
    "next": "^13.2.3",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "@types/node": "18.14.2",
    "@types/react": "18.0.28",
    "@types/react-dom": "18.0.11",
    "eslint": "8.35.0",
    "eslint-config-next": "^13.2.3",
    "typescript": "4.9.5"
  }

Since then I am getting lots of new linting errors when trying to deploy the same code to Vercel which was deploying fine yesterday. Here is an example

Type error: 'supplierId' is possibly 'undefined'.
  56 | 
  57 |   // Get Supplier Products
> 58 |   const supplierProductsQuery = trpc.supplierProducts.get.useQuery({supplier_id: supplierId}, { enabled: supplierId > 0, ...refetchNever });

This code looks fine to me. I know the variable might be undefined and that's why I'm using it as a flag to enable something when it's not. Anyway, that's an aside. The point is that I don't get any errors like this running locally, running next dev, next lint and next build all run with no errors, but on Vercel it seems to be much stricter all of a sudden, or be running totally different linting rules.

Can anybody explain why this might be?

jonhobbs
  • 26,684
  • 35
  • 115
  • 170
  • Different dependencies perhaps, or typescript settings? – Evert Mar 03 '23 at 01:55
  • But all the settings are in the tsconfig, package.json, eslintrc etc. so they should all be the same, that's the bit I don't get. – jonhobbs Mar 03 '23 at 15:00
  • If all else fails, install your local dev env from scratch. Perhaps you got a weird set of dependencies that doesn't match prod and this will at least ensure you're starting from the same point before you debug further. – Evert Mar 03 '23 at 16:39
  • Did you ever figure this out. I am having the same issue. I get type errors in vercel for the library types I am using even tho it doesn't show any errors in Dev or when running npm run build. – Chris Scott Aug 05 '23 at 18:51

0 Answers0