Q&A

LIFF getFriendship sometime catch error but only return empty object

Pre condition, Condition to reproduce

When I try to get friendship status and if 'friendFlag === false' then redirect to add friend page sometime it catch and return object Error{} this error occur 20/03/2021, I think this project finished around 10/2020 It never happend before

Issue/ Error Message details

This only happen in LINE android not Desktop (not sure about IOS) Error{}

Accompanying respective source code

initLiff = async (decodedToken) => { console.log('initLiff') if (decodedToken.liffId) { try { await liff.init({ liffId: decodedToken.liffId })

    const error = this.props.error
    if (error === 'access_denied') {
      liff.closeWindow()
    }

    if (error) {
      console.log('initLiff error')
      return this.setState({ isError: true })
    }

    const isLoggedIn = liff.isLoggedIn()
    console.log('isLoggedIn', isLoggedIn)
    if (!isLoggedIn) {
      return this.redirectLogin()
    }

			// this is where error happend
    const isFriend = await liff.getFriendship()
    if (!isFriend.friendFlag) {
      return this.redirectLogin()
    }

    this.getAccessToken(decodedToken)
  } catch (e) {
    this.setState({ isError: true })
  }
} else {
  this.setState({ isError: true })
}

}

Resolution Tried

originally I use @line/liff 2.4.1 and I upgrade to 2.8.1 It won't help

if I remove liff.getFriendship() completely error never occur

I console.log and try to remove everything at a time still don't get anything useful So I think cause by liff.getFriendship()

Reference information (Version / Platform/ environment)

@line/liff 2.4.1

web develop with preact-cli 3.0.0

System: Android 9 UA: Mozilla/5.0 (Linux; Android 9; Redmi Note 6 Pro Build/PKQ1.180904.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.105 Mobile Safari/537.36 Line/11.4.1 LIFF

  • 0
  • 1
  • 1229
  • twitter facebook

It seems LIFF API outage.

https://developers.line.biz/en/news/2021/03/23/liff-outage/

  • 0

関連する質問

    関連する質問はありません

本当によろしいですか? question.vm