Cloudflare HTTP headers · Cloudflare Fun...
Hi, all.
I'm playing with the context workers and I have a few questions:
1. what is the correct type for the request, so the Typescript does not complain about
system
and client
?
The documentation isnt showing the TS version and everything that I tried - fails. Or should I write the types manually (I will do that for now, of course).
2. Are there any ways how to get the headers
values from the incoming request? Or is there a way how to get them in the Zaraz context? Everything I try either returns null values.
I am talking about this part of the headers: https://developers.cloudflare.com/fundamentals/reference/http-headers/Cloudflare Docs
Cloudflare HTTP headers · Cloudflare Fundamentals docs
Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below.
4 Replies
@m.muiznieks
1. I built/use this: https://www.npmjs.com/package/@mackenly/zaraz-tools so:
2. Can't think of anything for this off my head.
npm
@mackenly/zaraz-tools
Unofficial 3rd party toolkit for Zaraz. Latest version: 0.2.4, last published: 2 days ago. Start using @mackenly/zaraz-tools in your project by running
npm i @mackenly/zaraz-tools
. There are no other projects in the npm registry using @mackenly/zaraz-tools.Will take a closer look.
But for now I decided not to use this feature as I hit two major issues - it sometimes pass wrong
client
object to main Zaraz worker, where instead of actual client data it consists from the data that is related to Context worker (i.e. client.url is zaraz script url).
And I hit the errors of "Durable object exceeded maximum computing time" at the Zaraz worker.That's definitely weird! Haven't encountered that one (though I have run into some weirdness with enrichers).
Yes, I actually didn't do anything wrong or different - I just made a KV call with the same function I do on the Zaraz (I would like to move that in front of Zaraz, to reduce unnecessary event calls).
I caught that because I have a function in place that checks between client.url.href and payload.page.url.href - so thats how it surfaced.
Technically the client variable is not 100% necessary, but its too deep integrated in the whole process to quickly get rid of it.
And then a wall of durable object errors appeared.
But maybe I'm just "special." A few days ago I run into issues with workflows as well, but they admitted that it was a bug and probably the fix will be rolled in this week.