gadnuk_breaker_of_worlds
12/19/2023, 7:05 PMArnø
12/20/2023, 8:22 AMpigri
12/20/2023, 5:22 PMThanks for reaching out to the Datadog support team! My name is Victorien and I'll handle your request from now on.
After further investigation, this does appear to be a limitation from Cloudflare. Logs are sent as arrays of objects and sent as part of Workers Trace Events: https://developers.cloudflare.com/logs/reference/log-fields/account/workers_trace_events/.
On our end, there is no option to split logs after ingestion. This action must be performed upstream. Therefore, I would suggest reaching out to Cloudflare to inquire whether they could eventually provide flexibility in the way logs are output.
Alternatively, you could send your Cloudflare logs to a custom destination, split those logs on your end (with a script for example), and then forward these logs to Datadog (it could be achieved by using the Datadog Agent or our API: https://docs.datadoghq.com/logs/log_collection/?tab=host).
Any ideas for this?roger_57097
12/21/2023, 7:06 AMamr21_
12/21/2023, 10:19 AMjs
{
messages: {
"mkey1": "....",
"mkey2": "....",
}
}
is it possible to just get mkey1 without getting all messages?2adventure
12/21/2023, 2:22 PMts
export interface Env {
MY_SERVICE_BINDING: any;
}
The binding in the wrangler.toml:
toml
services = [
{ binding = "MY_SERVICE_BINDING", service = "the-worker-im-calling" }
]
The service binding fetch call:
ts
const result = await env.MY_SERVICE_BINDING.fetch("MY-STRING");
c_bonadio
12/21/2023, 3:59 PM_arizmendi_
12/22/2023, 4:33 AMcyco130
12/22/2023, 12:23 PMwillin
12/22/2023, 12:31 PMa.com/api/sth
b.com/api/sth
c.com/api/sth
if worker does not have response, then fetch origin a.com/api/sth
as result.
how to write the fetch codes in the worker script?2adventure
12/22/2023, 9:47 PMts
const ai = new Ai(env.AI);
const prompt = [
{ role: "system", content: "Prompt" },
{ role: "user", content: "Prompt" },
{ role: "assistant", content: "Prompt" },
]
const result = await ai.run('@cf/meta/llama-2-7b-chat-int8', { messages: prompt });
ftqo
12/22/2023, 10:13 PMthatbeanlady
12/23/2023, 2:07 AMslowaspondwater
12/23/2023, 2:53 AMsend errors
means in the docs above.
I am hoping to enable this but unsure if that means I will need to bake in Sentry the old-fashioned way.nosebleeeed
12/23/2023, 10:03 AMangusma
12/23/2023, 3:09 PMjs
const ai = new Ai(env.AI);
const output = ai.run('@cf/meta/llama-2-7b-chat-int8', {
prompt: args.prompt
}).then(function (result){
return result;
}).then(async function (result){
await fetch('https://discord.com/api/v10/webhooks/'+env.DISCORD_APPLICATION_ID+'/'+interaction.token+'/messages/@original',{
method:'PATCH',
headers:{'content-type': 'application/json;charset=UTF-8',},
body:JSON.stringify({
content: result.response,
})
})
})
The error (root directory path replaced with PROJECT_DIR):
✘ [ERROR] Uncaught (in promise) SyntaxError: Unexpected token 'E', "ERROR 3026"... is not valid JSON
at async InferenceSession.run
({PROJECT_DIR}/.wrangler/tmp/dev-5g4ZDx/server.js:6124:26)
at async Ai.run
({PROJECT_DIR}/.wrangler/tmp/dev-5g4ZDx/server.js:6192:30)
✘ [ERROR] Uncaught (async) SyntaxError: Unexpected token 'E', "ERROR 3026"... is not valid JSON
devced_46565
12/24/2023, 1:41 AMG4G4N
12/24/2023, 10:04 AMtrader
12/24/2023, 11:32 AMts
// Add Cloudflare Access Service Token credentials as global variables, used when Worker
// establishes the connection to Cloudflare Tunnel. This ensures only approved services can
// connect to your Tunnel.
declare global {
var CF_CLIENT_ID: string | undefined;
var CF_CLIENT_SECRET: string | undefined;
}
globalThis.CF_CLIENT_ID = CF_SERVICE_CLIENT_ID;
globalThis.CF_CLIENT_SECRET = CF_SERVICE_CLIENT_SECRET;
...
Not always an easy access to Fetch API is available. For example when using vector databases' client etc. 🙂Iron_Max
12/25/2023, 4:46 PMsupport@domain.com
to multiple mails 1mail@gmail.com
, 2mail@gmail.com
, 3mail@gmail.com
bnowak_83546
12/25/2023, 6:25 PMworkerd/jsg/util.c++:281: error: e = kj/compat/tls.c++:221: failed: TLS peer's certificate is not trusted; reason = unable to get local issuer certificate
Later validated that indeed any https call from within the worker will trigger the error.
What I've tried so far to solve it:
* in my wrangler.toml
make local_protocol = "https"
* replace my package.json run script wrangler.dev
with NODE_EXTRA_CA_CERTS=/absolute/path/to/fullchain.pem wrangler dev
Does not seem to help, despite the internet search(es) saying it should.
Other useful info:
* wrangler version: ^3.22.1
* local ssl cert is a valid one from Letsncrypt/certbot, and nginx/browser have no issues with it.
* relevant bits of Dockerfile:
FROM node:20-slim as platform-dev
do stuff
RUN apt-get install procps openssl -y
Any advice would be appreciated. Thanksjustjumper_
12/25/2023, 9:38 PMxarvinss
12/26/2023, 11:15 PMBearer ${env.API_KEY}
,
'User-Agent': 'CF-Worker-API-Client/1.0',
'Cache-Control': 'no-cache, no-store, must-revalidate',
},
cf: {
cacheTtl: -1 // Bypass Cloudflare's cache
}
});plopix
12/27/2023, 12:56 AMcfored
12/27/2023, 1:38 AMwillin
12/27/2023, 3:42 AMgadnuk_breaker_of_worlds
12/27/2023, 9:43 AMEezergoode
12/27/2023, 11:03 PMfetch(request)
which forwards the request on to the origin (Shopify) but locally it it won't know where the origin is. If I overwrite the url to fetch from Shopify it will hit my worker in production. How are others working around this w/ O2O?Erisa | Support Engineer
12/28/2023, 11:40 AMcolearendt
12/28/2023, 12:29 PMapplication/json
, everything works swimmingly. Use data.body
just like the examples, etc.
However, if I submit the data as a application/x-www-form-urlencoded
, then I get nothing.
Moreover, if I try to read FormData()
off of the request, then I get "body has already been read." Presumably the body is read during the body sanitization / verification / schema-matching done by itty-router.
Any recommendations for which direction to go here? Is there a way to access FormData
through itty-router-openapi
?
https://github.com/cloudflare/itty-router-openapi