diff --git a/.changeset/nasty-clocks-share.md b/.changeset/nasty-clocks-share.md new file mode 100644 index 00000000000..341a770cc3e --- /dev/null +++ b/.changeset/nasty-clocks-share.md @@ -0,0 +1,5 @@ +--- +"fuels": patch +--- + +chore: handling `EADDRNOTAVAIL` errors on top of `ECONNREFUSED` diff --git a/packages/fuels/src/cli/commands/deploy/createWallet.ts b/packages/fuels/src/cli/commands/deploy/createWallet.ts index 46f65108dff..112fea6a176 100644 --- a/packages/fuels/src/cli/commands/deploy/createWallet.ts +++ b/packages/fuels/src/cli/commands/deploy/createWallet.ts @@ -18,8 +18,7 @@ export async function createWallet(providerUrl: string, privateKey?: string) { return Wallet.fromPrivateKey(pvtKey, provider); } catch (e) { const error = e as Error & { cause?: { code: string } }; - - if (error.cause?.code === 'ECONNREFUSED') { + if (/EADDRNOTAVAIL|ECONNREFUSED/.test(error.cause?.code ?? '')) { throw new FuelError( FuelError.CODES.CONNECTION_REFUSED, `Couldn't connect to the node at "${providerUrl}". Check that you've got a node running at the config's providerUrl or set autoStartFuelCore to true.`