Forum Discussion
SPFx webpart doesn't work after deploy
Hi,
We have a webpart that when run on the workbench works as expected. Its using PnP to get the user profile and then searches a list to find list items.
The webpart fails with the call to the Profile Service no error shown on screen, but in the console log we have the following
Any help please as its doing my head in.
Thanks
2 Replies
- eldren_bahian_lorca_srCopper Contributorthank you all and make safest and secured all of my log in on one screen only
Mccartc11025 did you supply the web part context to PnP JS library while using it within SPFx?
Example:
import pnp from "sp-pnp-js"; // ... public onInit(): Promise<void> { return super.onInit().then(_ => { pnp.setup({ spfxContext: this.context }); }); }Above code might differ based on the version of PnP JS you are using. Check below threads for more details:
Also, make sure you are using --ship while bundling and packaging the solution, like:
gulp bundle --ship gulp package-solution --shipPlease click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.