0

First of all, Happy Christmas and Happy new year.

I have an issue trying to display a RSS feed into a SPFx webpart. I'm using this code on github: https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-rss-reader

My question is that it works for most (or all) all the RSS I tried. but it's not working for the one I need. the RSS I need is: https://app.meltwater.com/gyda/outputs/61a2031e3a4e2460ca000001/rendering?apiKey=5e590ecce181600011955457&type=rss

The error I'm getting is different according on the service I'm using. (the code above allows 3 services (Direct Request, feed2json.org and rss2json)

  • with rss2json I'm getting "An error occurred attempting to retrieve the feed - Unable to convert rss feed, source is not valid"

  • with feed2json I'm getting "An error occurred attempting to retrieve the feed - TypeError: Failed to fetch - Possibly blocked by CORS policy."

On my console I'm getting the following error: "Access to fetch at 'https://feed2json.org/convert?url=https://app.meltwater.com/gyda/outputs/61a2031e3a4e2460ca000001/rendering?apiKey=5e590ecce181600011955457&type=rss' from origin 'https://localhost:4321' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

I did a Google search but I didn't find nothing clear.

Can you please advise me to the right direction?

Thanks,

1 Answer 1

2

There are two alternatives:

  1. Find a proxy server service that works
  2. Implement own proxy server (e.g., on Azure Functions)
  3. Convince Meltwater to add your SPO domain into their service CORS settings

I've personally done option 2. and also improved the sample web part to fix few issues. And yes, number 3 isn't really an option ;)

2
  • Could you guide me in how you did number 2. (for me the RSS that does not work actually is on a server that I might be able to do no.3.) But maybe not :P Jun 29, 2022 at 14:14
  • It's a very simple server application running on pretty much any platform, as long as it is server side code. It takes at least the URL of the RSS feed as parameter, fetches data from that URL (on the server side) and returns the data (RSS feed data) to the client (your JavaScript in this case).
    – Jussi Palo
    Jul 4, 2022 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.