Skip to content

Intermittent build errors #731

@kernelwhisperer

Description

@kernelwhisperer

Sometimes you get this error:

apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts:43:11 - error TS2322: Type 'import("/home/daniel/repos/cow/cowswap/node_modules/@cowprotocol/sdk-order-book/dist/index").OrderBookApi' is not assignable to type 'import("/home/daniel/repos/cow/cowswap/node_modules/@cowprotocol/sdk-bridging/node_modules/@cowprotocol/sdk-order-book/dist/index").OrderBookApi'.
  Types have separate declarations of a private property 'rateLimiter'.

More context: https://cowservices.slack.com/archives/C0361CDG8GP/p1763460061456139
You can also see the build errors in cowprotocol/cowswap#6620

I think the issue is that cow-sdk is being published with the following section in its package.json:

  "dependencies": {
    "@cowprotocol/sdk-app-data": "4.3.4",
    "@cowprotocol/sdk-common": "0.4.0",
    "@cowprotocol/sdk-config": "0.6.0",
    "@cowprotocol/sdk-contracts-ts": "0.7.3",
    "@cowprotocol/sdk-order-signing": "0.1.18",
    "@cowprotocol/sdk-order-book": "0.4.2",
    "@cowprotocol/sdk-trading": "0.6.2"
  },

And if you have other conflicting packages, like we do:

"@cowprotocol/sdk-bridging@^0.8.3":
  version "0.8.5"
  resolved "https://registry.yarnpkg.com/@cowprotocol/sdk-bridging/-/sdk-bridging-0.8.5.tgz#c45090b06af1084fc1a8edba9841ffd40e3c2d73"
  integrity sha512-tQFt/Ey5YuY0Q9q3nruZpbVpwpOEFV8DLu7DMoawPNcDsY6N1S01Vx8KRZUwHEibYRu2AOKhKCKAQAfCqBAR+g==
  dependencies:
    "@cowprotocol/sdk-app-data" "4.3.2"
    "@cowprotocol/sdk-common" "0.4.0"
    "@cowprotocol/sdk-config" "0.4.1"
    "@cowprotocol/sdk-contracts-ts" "0.7.1"
    "@cowprotocol/sdk-cow-shed" "0.2.3"
    "@cowprotocol/sdk-order-book" "0.4.0"
    "@cowprotocol/sdk-trading" "0.6.0"
    "@cowprotocol/sdk-weiroll" "0.1.7"
    "@defuse-protocol/one-click-sdk-typescript" "0.1.1-0.2"
    json-stable-stringify "^1.3.0"

Typescript is confused about which type definition to use, from [email protected] or [email protected]

Long term solution

Deploy the package with ^ dependencies, e.g.:

    "@cowprotocol/sdk-order-book": "^0.4.2",

This way common deps like @cowprotocol/sdk-order-book can be deduped.

Short term solution

You need to ensure all your cow-sdk packages are upgraded in tandem, for example:

yarn add @cowprotocol/cow-sdk @cowprotocol/sdk-bridging @cowprotocol/sdk-composable @cowprotocol/sdk-cow-shed @cowprotocol/sdk-ethers-v5-adapter @cowprotocol/sdk-subgraph

And not let them use different, conflicting versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions