GetStream / stream-js

JS / Browser Client - Build Activity Feeds & Streams with GetStream.io

Home Page:https://getstream.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Axios error when updating grants of roles on a channel type

JayMehta97 opened this issue · comments

stream-chat version: 6.5.1

I recently migrated our permissions version of stream chat to v2. I programmatically created new roles for our use case. Next I wanted to nullify all current role grants in specific channel types and from scratch only add permissions for our custom roles. I followed the documentation to nullify it with:

await client.updateChannelType(customChannelType, {
    grants: null
});

And add grants for custom roles using:

await client.updateChannelType(customChannelType, {
    grants: [
        "customRole": [
            "add-links",
            ....
        ],
        ....
    ]
});

But everytime I run even any one of the above code blocks, they both throw error. There are existing channels with many members of the channel type that I am trying to update here.

Error response when I try to give grant to custom roles using above code block:
Keys of the error object:

[
  'config',
  'code',
  'request',
  'response',
  'isAxiosError',
  'toJSON',
  'client_request_id'
]

Value of:
Code - "ECONNABORTED"
isAxiosError - true
response - undefined
Some part of toJSON:

{
  message: 'timeout of 3000ms exceeded',
  name: 'Error',
  description: undefined,
  number: undefined,
  fileName: undefined,
  lineNumber: undefined,
  columnNumber: undefined,
  stack: 'Error: timeout of 3000ms exceeded\n' +
    '    at createError (/Users/.../MyApiProject/node_modules/stream-chat/node_modules/axios/lib/core/createError.js:16:15)\n' +
    '    at RedirectableRequest.handleRequestTimeout (/Users/.../MyApiProject/node_modules/stream-chat/node_modules/axios/lib/adapters/http.js:328:16)\n' +
    '    at RedirectableRequest.emit (events.js:210:5)\n' +
    '    at RedirectableRequest.EventEmitter.emit (domain.js:475:20)\n' +
    '    at Timeout.<anonymous> (/Users/.../MyApiProject/node_modules/follow-redirects/index.js:164:12)\n' +
    '    at listOnTimeout (internal/timers.js:531:17)\n' +
    '    at processTimers (internal/timers.js:475:7)',
  code: 'ECONNABORTED',
  status: null
}

Have I misunderstand any of the steps for updating these roles?

This is feed SDK, chat SDK is here: https://github.com/GetStream/stream-chat-js

As you see in the error message, it's a client side timeout error, means your connection is slow. You can provide a bigger timeout while creating the client. {timeout: 10000} as the last option for client constructor.

Hey @ferhatelmas,

Thanks for the reply, my bad on creating this issue in feeds SDK. I have a stable internet connection, even other stream calls work but only this call is failing everytime so not sure if my internet connection is the issue but I will still try with bigger timeout.