Forum Discussion
LadislavStupak
Jun 22, 2021Brass Contributor
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...
- Jun 24, 2021I 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.
LadislavStupak
Jun 24, 2021Brass Contributor
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.
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.