Getting an Error from communityForId

I’m trying to get the data (eg. avatarFileId, displayName, …) from community by using communityForId with specifically community ID

const community =  CommunityRepository.communityForId(id)
      community.on('dataUpdated', data => {
        console.log(data)
      })
      community.on('loadingStatusChanged', ({ newValue}) => {
        console.log(newValue)
      })

Then I found some community has error as a newValue with no data from ‘dataUpdated’.
But, I still can join and post to that community.

Could you give me a help or idea to fix this

Hello,

You may find more informations by checking the data error event such as:

const liveCommunity = CommunityRepository.communityForId(communityId)

liveCommunity.on("dataError", err => {
  console.error(err)
})

With this information we may be able to help you more.

Sincerely,
J.

I have tried what you suggested.
Then I got "description" is not allowed to be empty" as figure below

2021-07-08 at 16.12

We are also can’t make user to add description.
Does any way to ignore this error?

Hey @JustTod ,

Could you let me know how did you create this community? Is it from the sdk itself or from the asc console? Also could you let me know your sdk’s version?

Thank you

We are using "eko-sdk": "^4.4.3". And I believe this community was created by sdk.

Hi @JustTod ,

There are couple of options for you to solve this issue.

  • Upgrade the eko-sdk to the latest npm i -s eko-sdk@latest.
  • Consider our newest major version with npm i -s @amityco/js-sdk. There’s a migration guide in our docs here.

Let me know if that helped.

1 Like