Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException "An error occurred while trying to access an object of type: UserRoles, Object value is null" #172

Open
courtney-orderbot opened this issue Oct 4, 2023 · 2 comments

Comments

@courtney-orderbot
Copy link

I am having trouble with this error. It shows up, not sure what is going on, and then suddenly it disappears - only to show up a couple weeks later. The inconsistency is making it difficult to code properly.

This happens when I make any GET request to the endpoints. The one in question I'm trying is the /Items endpoint,
https://REDACTED:52000/Items?Page=1&Rows=100

This is the error:

{
    "ResponseStatus": {
        "ErrorCode": "NullReferenceException",
        "Message": "An error occurred while trying to access an object of type: UserRoles, Object value is null,    at NCR.CP.CPAPI.SDK.RepositoryCompanyBase.GetCacheKeyName(Object[] cacheKeyId)"
    }
}

I'm also using the proper company credentials to authenticate as it's worked before.

User: companyname.COMPANYUSER
Pass: CompanyPassword

I've checked that the user exists and it has the correct API permissions.

One thing to note is when that error is occurring, I get a 401 error when trying to login to the API Admin console.

Please help! I'm thinking something is invalidating the cache but I'm not sure what it is or how it gets set!

@Oliver3Sprott
Copy link

I've experienced a similar error before. I believe restarting the Counterpoint API service will temporally fix the issue. But to fully resolve it on my end I had to delete and recreate the Users/User Roles in the API Admin console.

@dmaziuk
Copy link

dmaziuk commented Oct 11, 2023

If you have password aging on, update sy_usr set lst_pwd_chng_dat=convert(nvarchar,getdate(),112) where usr_id=${YOUR_API_USER} will keep your API user's password from expiring -- that's one possible cause of the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants