Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant get it to run #3

Open
the-hidden-eye opened this issue Feb 27, 2024 · 4 comments
Open

cant get it to run #3

the-hidden-eye opened this issue Feb 27, 2024 · 4 comments

Comments

@the-hidden-eye
Copy link

  Uncaught TypeError: globalThis.XMLHttpRequest is not a constructor
    at null.<anonymous>
  (file:///home/someone/foobar/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js:20:11)
  in checkTypeSupport
    at null.<anonymous>
  (file:///home/someone/foobar/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js:39:45)
  in node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js
    at null.<anonymous> (worker.js:9:58) in __init
    at null.<anonymous>
  (file:///home/someone/foobar/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/request.js:1:1)
  in node_modules/rollup-plugin-node-polyfills/po

even upgrading node modules did not help
and https://github.com/apacheli/web-workers-polyfill also refused to work ( or my skills are not on that level to implement it )

ty

@dethos
Copy link
Owner

dethos commented Feb 27, 2024

Hello, can you provide a few more details, so I can try to reproduce the problem?

Things that would be useful:

  • Node.js version you are using
  • Which version of worker-planet are you using? The current master branch?
  • At which stage did this error happen? (did you run npm install and npm run build successfully)?

@the-hidden-eye
Copy link
Author

node v18.17
current master from git
during wrangler deploy ( obviously one of the libs tries to use XMLHttpRequest whereas CF workerrs only support fetch() )

@NicoJuicy
Copy link

Got it to work. For those interested.

  1. My RSS feed didn't had a pubDate field but a a10:updated field.
    This required 2 changes
  • In the parser
    let parser = new Parser({customFields:{item: ['a10:updated']}})

  • Setting the custom date field:

for (let item of contentFeed.items) {
    item.source_title = contentFeed.title
    item.source_link = contentFeed.link
   
   
    if ('content:encoded' in item) {
      item.content = item['content:encoded']
    }
    // This was the added part
    if(item['a10:updated'] && !item.pubDate){
      item.pubDate = item['a10:updated'];
    }
  }
  1. Saving to RSS and Atom failed in the cronjob ( something with time). Since i'm only interested in HTML, i disabled 3 lines because of that:
// let feed = createFeed(content)
...
// await WORKER_PLANET_STORE.put('rss', feed.rss2())
// await WORKER_PLANET_STORE.put('atom', feed.atom1())
  1. It took a while to get the cronjob locally. So i executed the cronjob untill that part succeeded ( don't forget to remove it again)
    In the function handleRequest, execute:
    await handleScheduled();

Don't forget to remove this part again :)

@dethos
Copy link
Owner

dethos commented May 22, 2024

@NicoJuicy thanks for the feedback.

However, I think it is unrelated to the original problem described in this issue.

The “date” stuff is definitely worth an independent issue.

  1. It took a while to get the cronjob locally. So i executed the cronjob untill that part succeeded ( don't forget to remove it again)
    In the function handleRequest, execute:
    await handleScheduled();

I want to add a way to more easily fetch and test the content when developing (could also be useful for the first deploy). I'm still figuring out the best way to achieve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants