Skip to content

bug(hub-nodejs): getCurrentStorageLimitsByFid "Value is larger than Number.MAX_SAFE_INTEGER" #2547

@tybook

Description

@tybook

What is the bug?

It seems when the getCurrentStorageLimitsByFid method is called on at least FID 348778, hubs return an invalid value. Looking in the debugger, the underlying hub API returns -1, which is then interpreted as an unsigned int, causing the overflow error.

Not sure if this is really a bug at the hubble or hub-nodejs level.

How can it be reproduced? (optional)

import { getSSLHubRpcClient } from '@farcaster/hub-nodejs';

const hub = getSSLHubRpcClient('nemes.farcaster.xyz:2283');
hub
  .getCurrentStorageLimitsByFid({
    fid: 348778,
  })
  .then((response) => {
    if (response.isOk() && response.value) {
      console.log('SUCCESS: ', response.value);
    } else {
      console.error('ERROR: ', response.error);
    }
  });
root@105a5e85fea3:/monorepo/packages/service.neynar-api# node src/scripts/repro.js 
ERROR:  HubError: Response message parsing error: Value is larger than Number.MAX_SAFE_INTEGER
    at fromServiceError (file:///monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/dist/index.mjs:10161:10)
    at Object.callback (file:///monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/dist/index.mjs:10178:43)
    at Object.onReceiveStatus (/monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/node_modules/@grpc/grpc-js/build/src/client.js:193:36)
    at Object.onReceiveStatus (/monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
    at Object.onReceiveStatus (/monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:320:181)
    at /monorepo/packages/service.neynar-api/node_modules/@farcaster/hub-nodejs/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78
    at process.processTicksAndRejections (node:internal/process/task_queues:85:11) {
  errCode: undefined,
  presentable: false,
  [cause]: undefined
}

Additional context (optional)
Reproduced against multiple hubs, but this is the only known FID causing the error currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    s-triageNeeds to be reviewed, designed and prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions