Forum Discussion

jean Bertrand's avatar
jean Bertrand
Copper Contributor
Apr 18, 2017

Problem with SPFx Webparts (using PnP-JS-Core) on Sharepoint SitePages

Hi everyone,

 

I'm working with SPFx framework and I'm using the Pnp js library for REST requests. Everything was working fine since last week when REST requests stop working on sharepoint SitePages but not on the workbench.

When I debug, I notice that the endpoint url changed on the sitepages.

 

For example, i used to have 

https://<tenant>/_api/web/lists?$filter=BaseTemplate%20eq%20171

but now I'm getting

https:/<tenant>/SitePages/_api/web/lists?$filter=BaseTemplate%20eq%20171

and it's not working

 

Does anyone have the same problem and knows how to solve it?

 

Thank you.

  • Hi Jean,
    I got the same problem.

    When working on workbench it works fine. But when I use the client web part on a modern site page the REST web API requests don't work anymore.
    • Patrick Rodgers's avatar
      Patrick Rodgers
      Icon for Microsoft rankMicrosoft

      Tried to reply earlier but didn't seem to post...

       

      This was found and fixed earlier this week and is currently available in a beta release

       

      install sp-pnp-js@beta --save

       

      Please give it a try and if it works as expected we can look to cut a release later today since this is a blocker for folks and we don't want that.

       

      As a side note - if you find issues please do use the issues list. That makes it much easier for us to see what problems folks might be having and address them. Thanks!

      • Patrick Rodgers's avatar
        Patrick Rodgers
        Icon for Microsoft rankMicrosoft

        Actually, I just pushed 2.0.4 which includes this fix. It was an out of band update but this is a blocker so was needed. Please update to latest and let us know if you still see issues. Our bad on missing that bug in testing.

    • Patrick Rodgers's avatar
      Patrick Rodgers
      Copper Contributor
      Hi, this was reported a few days ago and is fixed in the latest beta. Can you give that a try using

      npm install sp-pnp-js@beta --save

      and let me know if that works? If so I am considering cutting an early release since this is a blocker for folks. Thanks!

      P.S. In the future if you have an issue or find a bug please report it to the issues list - much easier to track and manage there.

Resources