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

@tenderly/hardhat-tenderly missing explicit dependency on @tenderly/api-client #265

Open
aspiers opened this issue Nov 26, 2024 · 1 comment

Comments

@aspiers
Copy link

aspiers commented Nov 26, 2024

@tenderly/hardhat-tenderly depends directly on @tenderly/api-client:

import {
CHAIN_ID_NETWORK_NAME_MAP,
NETWORK_NAME_CHAIN_ID_MAP, PLUGIN_NAME,
TENDERLY_JSON_RPC_BASE_URL,
} from "@tenderly/api-client/common/constants";
import{ TenderlyNetwork as TenderlyNetworkInterface } from "@tenderly/api-client/types";
import { logger } from "./logger";
import { TenderlyService } from"@tenderly/api-client";

However, this is not captured as a direct dependency in its package.json:

"dependencies": {
"@ethersproject/bignumber": "^5.7.0",
"@nomicfoundation/hardhat-verify": "^2.0.8",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@openzeppelin/hardhat-upgrades": "^3.3.0",
"@openzeppelin/upgrades-core": "^1.32.2",
"ethers": "^6.8.1",
"dotenv": "^16.4.5",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@tenderly/hardhat-integration": "^1.1.0"
}

but only indirectly via the @tenderly/hardhat-integration dependency. This can lead to runtime module resolution errors, e.g.

An unexpected error occurred:

Error: Cannot find module '@tenderly/api-client/common/constants'
Require stack:
- /home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-tenderly/dist/setup.js
- /home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-tenderly/dist/index.js
- /home/adam/myrepo/packages/hardhat/hardhat.config.ts
- /home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/core/config/config-loading.js
- /home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/cli/cli.js
- /home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/cli/bootstrap.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/adam/myrepo/packages/hardhat/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:679:30)
    at Function.Module._load (node:internal/modules/cjs/loader:975:27)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-tenderly/src/setup.ts:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Object.require.extensions.<computed> [as .js] (/home/adam/myrepo/packages/hardhat/node_modules/ts-node/src/index.ts:1445:43)
    at Module.load (node:internal/modules/cjs/loader:1197:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-tenderly/dist/setup.js',
    '/home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-tenderly/dist/index.js',
    '/home/adam/myrepo/packages/hardhat/hardhat.config.ts',
    '/home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/core/config/config-loading.js',
    '/home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/cli/cli.js',
    '/home/adam/myrepo/packages/hardhat/node_modules/hardhat/internal/cli/bootstrap.js'
  ]
}

This is with yarn v3 configured with nmHoistingLimits: workspaces, resulting in the API client being installed under
/home/adam/myrepo/packages/hardhat/node_modules/@tenderly/hardhat-integration/node_modules/@tenderly/api-client.

The solution is presumably to explicitly list @tenderly/api-client as a dependency in the package.json.

@clemsos
Copy link

clemsos commented Dec 5, 2024

getting the same error here after migrating to 2.5.1

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

No branches or pull requests

2 participants