cant get it to run
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
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 installandnpm run buildsuccessfully)?
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() )
Got it to work. For those interested.
- 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'];
}
}
- 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())
- 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 :)
@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.
- 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.