thipperz
CDCloudflare Developers
•Created by thipperz on 7/25/2024 in #general-help
How to cache request coming from bots / crawlers?
I tried setting a Page Rule Cache Everything + Edge TTL 1 Month for a specific endpoint. In the logs, I can see bots calling that endpoint but apparently their visit do not trigger Cloudflare to cache the result (a dynamic image).
Visiting the image from a browser would then result in a MISS and subsequent requests would be a HIT.
2 replies
CDCloudflare Developers
•Created by thipperz on 7/22/2024 in #pages-help
next/og + Image Transformations - Unsupported image type: unknown
Above code works fine in local development, but in production it fails with the message
1 replies
CDCloudflare Developers
•Created by thipperz on 4/25/2024 in #pages-help
Fetch works locally, goes 522 when deployed
I would reaally appreciate some help when it comes to fetching an external API from inside of a Cloudflare Worker.
My API is running with Express at the url https:/[redacted].hstgr.cloud:3000/ and when I do fetch that locally, I get a proper response which is a JSON with a "message: Request Accepted!" - you see that in the browser.
So this works everywhere except inside a Worker:
const response = await fetch(
'https://[redacted].hstgr.cloud:3000/'
)
Inside a worker, it goes 522 and I can't get any info on it.
I tried messing up with nginx configs, disabled ufw, disabled Hostinger's Firewall, and also whitelisted Cloudflare IPs in my VPS machine.
Anything else I should look for?
5 replies
CDCloudflare Developers
•Created by thipperz on 4/14/2024 in #workers-help
Fetch requests in a Worker that is invoked from Service Binding always return 522
Curl requests to the target api are working fine. I tried moving the fetching code from that Worker to an API route in Next-on-Pages. When I do that, it works perfectly.
Not sure what else can I try. My situation seems close to this issue:
https://github.com/cloudflare/workers-sdk/issues/2589
1 replies
CDCloudflare Developers
•Created by thipperz on 4/10/2024 in #pages-help
What is the correct way of declaring a Service Binding (RPC)?
I've seen both
services = [
{ binding = "ADMIN", service = "todo-app" }
]
and
[[services]]
binding = "ADMIN"
service = "todo-app"
entrypoint = "AdminEntrypoint"
Also sometimes it includes
environment='production'
and sometimes not. Is there even an environment=local
?
I'm working with next-on-pages, R2 storage, D1, KV and Vectorize.
D1 and KV work fine locally, the others don't?1 replies
CDCloudflare Developers
•Created by thipperz on 4/10/2024 in #pages-help
Interacting with R2 Buckets During Local Development
I'm working on a project that involves uploading images to R2 buckets and then dynamically generating pages that display these images. However, I'm encountering challenges with simulating this interaction in my local development environment.
I've attempted using wrangler pages dev combined with RPC service bindings to fetch a worker locally, but it seems to fall short unless I initiate a wrangler dev session specifically for the worker that handles the export. This method, however, hits another roadblock since the worker requires wrangler dev --remote to interact with R2 or Vectorize. Unfortunately, initiating wrangler dev with the --remote flag makes it invisible to wrangler pages dev.
To sum up, I'm looking for a way to effectively test the upload and page generation process locally without deploying every change. The lack of a "next dev --remote" or "wrangler pages dev --remote" seems to complicate the process.
Does anyone have experience or advice on how to tackle this?
2 replies
CDCloudflare Developers
•Created by thipperz on 4/6/2024 in #pages-help
Can't access RPC Service Bindings in local (next dev)
i'm trying to access a Service binding (RPC) in my Next-on-Pages. My wrangler.toml looks like this:
When I call it like this, running
next dev
:
It does not throw this error, indicating that the binding was found, but I get the following warning regarding RPC:
The "Image Search" is defined in my worker like this:
It does work when running wrangler pages dev .vercel/output/static --service VECTORIZE_WORKER=vectorize-worker --compatibility-flag=nodejs_compat"
alongside the service worker running via wrangler dev
It does not work (and throws the error above) when running next dev
Is it possible to make rpc service bindings work via next dev? Also since my vectorize worker do access Vectorize, it will only work via wrangler dev --remote
which is then further incompatible with this local testing?4 replies