Truffle - Migrations replay-protected (EIP-155) transactions over RPC

Getting a truffle migration error when migrating to polygon with infura on network 137

Compiling your contracts…

Everything is up to date, there is nothing to compile.

Starting migrations…

Network name: ‘polygon_infura_mainnet’
Network id: 137
Block gas limit: 28791544 (0x1b752f8)

1_initial_migration.js

Deploying ‘Migrations’

*** Deployment Failed ***

“Migrations” – only replay-protected (EIP-155) transactions allowed over RPC – Reason given: Custom error (could not decode)…

Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.

Error: *** Deployment Failed ***

“Migrations” – only replay-protected (EIP-155) transactions allowed over RPC – Reason given: Custom error (could not decode)…

at /usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:379:1
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Migration._deploy (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:68:1)
at Migration._load (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:54:1)
at Migration.run (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:202:1)
at Object.runMigrations (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:152:1)
at Object.runFrom (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:117:1)
at Object.run (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:94:1)
at runMigrations (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:78:1)
at Object.module.exports [as run] (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:44:1)
at Command.run (/usr/local/Cellar/truffle/5.5.6/libexec/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:189:1)

Truffle v5.5.6 (core: 5.5.6)
Node v16.15.0

I’ve tried changing the HDWallet in the package.json to 1.4.0 but that did not help. Seems like an Infura issue but not sure.

Changing from

const HDWalletProvider = require("truffle-hdwallet-provider") to

const HDWalletProvider = require("@truffle/hdwallet-provider")

Solved this problem for me.

Hi @William_Lewis and welcome to our Infura community.

Thanks for sharing the solution which worked for you with our community.

1 Like