React js and Sharepoint error

suyog mahindrakar 21 Reputation points
2024-01-17T04:36:01.65+00:00

Hi All,

We are getting below error in ULS logs

  1. Claims Authentication bjku9 Unexpected The argument is null. ArgumentName: 'context'
  2. General ajkxg Medium No HttpContext given to be used to create an ContextUri.

Actually we have react componets which calls custom api which is deployed under iis folder of sharepoint site on page load React components successfully calls APi and no error after 2 or 3 minute same function getting called but gives error context not found, however when we debug api , it has no error , however client says 501 server error ,

please help to fix this issue Capture

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Development
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-01-17T07:34:38.0433333+00:00

    Hi @suyog mahindrakar, Since we are unable to reproduce your issue, you could refer to some similar issue to fix the issue. Please refer to following article https://stackoverflow.com/questions/63080452/react-createcontextnull-not-allowed-with-typescript

    ---If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-01-18T05:58:14.6333333+00:00

    Hi @suyog mahindrakar, I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum. By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread: [React js and Sharepoint error] Issue Symptom: react componets which calls custom api return value can't be null error. System.AppDomainUnloadedException: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014) Solution: In IIS "Request time" was set to 120 seconds, so if user kept site open for some time and call some api without page refresh, the request was coming as anonymous, hence sharepoint was throwing context is Null. Either we can increase request time out or we have written some code that calls our custom API eevry 90S so context never gets expired.

    ---You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!

    1 person found this answer helpful.
    0 comments No comments

  2. suyog mahindrakar 21 Reputation points
    2024-01-18T04:12:11.71+00:00

    Hi RaytheonXie_MSFT Thank you for your reply and suggestion. We have fixed our problem, actually in IIS "Request time" was set to 120 seconds, so if user kept site open for some time and call some api without page refresh, the request was coming as anonymous, hence sharepoint was throwing context is Null. Either we can increase request time out or we have written some code that calls our custom API eevry 90S so context never gets expired.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.