I am new to Cloudflare but find it incredible… So I try to learn fast.
Up to know I managed to have a Worker (worker.js) working fine.
Since It needs to be called from web pages, I have created a Pages app that gets the responses from the server.
But in order to have all in one place. I wish I could get my worker.js within my Pages project.
I tried to tweak it from the worker.js into _worker.js as adviced by Cloudflare (Refactor a Worker to a Pages Function) but got exeptions and the style.json from pages is not even provided anymore.
I am sure it is close but still blocked.
What I have done so far :
- added to my Pages project folder on my desktop a _worker.js file which is a copy of my worker.js that was working as a Worker.
- deployed this folder in a new Pages project
=> No luck. Got Exception Error 1101 Worker threw exception.
Looking in logs :
“message”: “Cannot read properties of undefined (reading ‘get’)”,
Help would be great !
P.S : my module is in ES modules format.