Skip to content

Wallet creation endpoint not working after refactor introduced recently #7218

@mrsarm

Description

@mrsarm

Creation of wallet address endpoint POST /api/v2/{coin}/wallet/{walletId}/address is not working anymore, and even the error doesn't follow the error format specified in the endpoint documentation here https://developers.bitgo.com/api/v2.wallet.newaddress.

Here is a POST request example with curl we tried against a BitGoJS Express instance we run, using a HTETH wallet (testnet coin):

curl -i -X POST "http://bitgo-express:3080/api/v2/hteth/wallet/{MY_WALLET}/address" \
     -H "Content-Type: application/json" -H "Accept: application/json" \
     -H "Bearer {MY_TOKEN}" \
     -d '{"label": "my-address-10", "forwarderVersion": 2}'

Response:

HTTP/1.1 400 Bad Request
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 158
ETag: W/"9e-SCCh1WHc45CyixlBppDuHU6JGvU"
Date: Mon, 13 Oct 2025 13:19:22 GMT
Connection: keep-alive
Keep-Alive: timeout=5

["Invalid value undefined supplied to : httpRequest/params: Exact<({ coin: string, id: string } & Partial<{  }>)>/0: { coin: string, id: string }/id: string"]

Environment Details

  • OS: we run BitGoJS with Docker using the official image bitgo/express:15.6.0
  • Node Version: Same we don't run it in our own version of Node
  • Yarn Version: Same above
  • BitGoJS Version: 15.6.0
  • BitGo Environment: testnet, coin HTETH

Expected Behavior

An HTTP 200 OK response, with a wallet address created.

Current Behavior

An HTTP 400 Bad Request response, with an validation error that is wrong, an no wallet address created.

Also the JSON response error doesn't follow the especification from the official documentation. Unexpected errors like this should be normalized through some sort of middleware that prevent the API to serialize error in whatever format not documented.

Possible Solution

The bug is in the source code of BitGo Express as far I understand, and it was introduced in a refactor here 4753b91#diff-2d63afad20775469d35fa72b1fc535af8b6daf51cf2aaa055983dd36ace25400L13-L16:

-  walletId: t.string,
+  id: t.string,

And here in the same commit 4753b91#diff-851997953dfe5ce12d4c10bbabf8afa6bc49777505aae9197b0bcc6534da6677L666:

- const wallet = await coin.wallets().get({ id: req.decoded.walletId });
+ const wallet = await coin.wallets().get({ id: req.decoded.id });

There the param argument was renamed from walletId to id, but it was not renamed in the path definition here

path: '/api/v2/{coin}/wallet/{walletId}/address',

CC @danielzhao122

Steps to Reproduce

Only one step described above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions