Forum Discussion

LadislavStupak's avatar
LadislavStupak
Brass Contributor
Jun 22, 2021
Solved

Uncaught (in promise) Error: Error making HttpClient request in queryable [404] Not Found

Dear ladies and gentlemen,   I receive following error after deployment of the SPFx solution to SharePoint 2019 App catalog:   "Uncaught (in promise) Error: Error making HttpClient request in que...
  • LadislavStupak's avatar
    Jun 24, 2021
    I had to add the onInit method to the web part class and set the context for sp there.

    import { sp } from "@pnp/sp";

    export default class TestPageWebPart extends BaseClientSideWebPart<ITestPageWebPartProps> {

    protected onInit(): Promise<void> {

    sp.setup({

    spfxContext: this.context

    });

    return super.onInit();

    }

    }

    In the test by "gulp serve", "pnp sp" will probably find the context even without this explicit link in the onInit method. After uploading the SPFx solution under SharePoint Apps in SharePoint 2019, this context is not found and must therefore be determined explicitly.

Resources