I need that for generating hash and use that for caching the queries using kv
I need that for generating hash and use that for caching the queries using kv
crypto.subtle which is built into all Workers, even without node compat: https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#digestdigest using SHA-1name = "foo" and don't specify a name specifically under env.dev, then that Worker when ran with --env dev is now called foo-dev.request.url when calling fetch(), which wouldn't exist within the context of a scheduled worker?wrangler tail
A Worker must be able to be parsed and execute its global scope (top-level code outside of any handlers) within 400 ms. Worker size can impact startup because there is more code to parse and evaluate. Avoiding expensive code in the global scope can keep startup efficient as well.
wrangler without deploying it?wrangler deploy it builds it and uploads it, but I just need it to stop at build :blobthinking:npx esbuild --bundle --minify src/index.js > worker.jscloudflare/wrangler-action@v3 sometimes failing to deploy due to binding to D1 failing (error 10021)? I can simply re-run my Action and it then succeeds, so it seems to be a bug. I can raise an issue if requiredwrangler.toml outside of the index.ts fech() method
async function hashString(input) {
const encoder = new TextEncoder();
const data = encoder.encode(input);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
return bufferToHex(hashBuffer);
}
function bufferToHex(buffer) {
const view = new DataView(buffer);
let hex = '';
for (let i = 0; i < view.byteLength; i += 1) {
const byte = view.getUint8(i).toString(16);
hex += byte.padStart(2, '0');
}
return hex;
}[env.dev.vars]
API_HOST = "localhost"
API_PORT = "9000"
[env.production.vars]
API_HOST = "engine.corsa.club"
API_PORT = "443"[[queues.producers]]
queue = "stats"
binding = "QUEUE"
[[queues.consumers]]
queue = "stats"
max_batch_size = 10
max_batch_timeout = 30