Cannot read propery 'updated_at' of undefined

I get the above error each time I getAccessTokenSilently using @auth0/react. I’ve checked my rules and everything else I can think of to try to determine where this is coming from and have come up empty. I even created a new tenant and getting the same error there. This is the code I’m using to retrieve the token:

  useEffect(() => {
    const getAccessToken = async () => {
      try {
        const accessToken = await getAccessTokenSilently({
          audience: `${config.audience}`,
          scope: 'read:users',
        })
        setToken(accessToken)
      } catch (e) {
        console.log('Token acquisition error: ', e.message)
      }
    }
    getAccessToken()

  }, [getAccessTokenSilently])

Hi @baronyoung can you disable the rules on the new test tenant to see if this error comes from a rule?

If the issue is caused by a rule, you may debug the issue with the Real-time Webtask log extension.

1 Like

Thanks for the quick reply. I have disabled both rules and still get the same error. The rules are very basic and don’t have any reference to an ‘updated_at’ field anyway. I also tried deleting my user and recreating - same result.

Forgot to mention that I don’t seem to get it with every request. It’s more like 50% of the time.

Hi @baronyoung could you send me two HAR files via email. One for the failing silent auth call and another with the successful silent auth. This can help me to compare the working and non-working calls. After capturing the HAR file, please keep the tenant configuration unchanged so that I can try to investigate the configuration at the same time. You may find how to capture the HAR file here.

1 Like

Hi Saltuk. I DM’ed you those files last night. Thanks for all your help!

Saltuk resolved my problem. I had some sample code that shouldn’t be there which passed a scope (read: users) via getAccessTokenSilently. I didn’t have permissions set up so this returned an error.

1 Like

Glad you have it working now and thanks for sharing with the rest of community!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.