Hey all, question. From the behavior I'm seeing, smart placement does not count requests to R2 as "s

Hey all, question. From the behavior I'm seeing, smart placement does not count requests to R2 as "subrequests", and therefore is not getting past the INSUFFICIENT_SUBREQUESTS placement status. Is this expected behavior?
15 Replies
Cyb3r-Jak3
Cyb3r-Jak310mo ago
What do you mean by force? If you set it then it should be on. You can’t force a location though
Sunil Kumar
Sunil Kumar10mo ago
I'm working on a small project i.e.., A user can install there subdomain path form main domain ex :- hashnode.com //main domain sunilkumar.hashnode.dev //sub domain like that we have personal access token to access particular details of a user and later we need to check like what are available domains on the user and we need to take which domain you need to install like that by using workers how can i achieve this problem . can anyone help me out the best way to achieve and also some insights and resources @andrew | as1003
mindermondo
mindermondo10mo ago
Hi. So, I have used the default workers example for caching POST request: https://developers.cloudflare.com/workers/examples/cache-post-request The scenario is the following: 1. User lands on the page and the POST request to the endpoint is made via XHR (AJAX) call. The Cf-Cache-Status is DYNAMIC ✅ 2. Same user hits this endpoint with the same payload and CF returns the cached result. The Cf-Cache-Status is HIT ✅ 3. When another user from a different device hits the same endpoint, CF still hits the origin. How can I serve the same cached response to all users instead of only the one that's requesting the cached URI (endpoint)?
Cache POST requests · Cloudflare Workers docs
Documentation for Cloudflare Workers, a serverless execution environment that allows you to create entirely new applications or augment existing ones …
MaxMax
MaxMax10mo ago
This may be a stupid question but how do I find out if my worker runs terminate early? I had issues with some code only being executed partly but I see no indications of that in logs
Hello, I’m Allie!
Is the event you are looking at an HTTP-event, or something else?
MaxMax
MaxMax10mo ago
It's a sveltekit application and more specifically a form submission which is processed serverside on +page.server.svelte. The +page.server.svelte code is executed in a cloudflare worker There I do 2 supabase DB requests + 2 other API calls to some email api
Hello, I’m Allie!
If you don’t use waitUntil, then as long as you receive a response, the Worker will have completed its task
MaxMax
MaxMax10mo ago
I don't use waitUntil. The thing is I could not reproduce the issue yet when I had logs trailing with wrangler. The only thing I see is that the last API call did not happen. But is there any way to see this in the cloudflare logs to be certain this is actually the issue?
Hello, I’m Allie!
Does it happen if you run it locally with wrangler? You could also log the API response to see that it does go through
dave
dave10mo ago
I wanted to put the Worker in the US region so I wouldn't get billed for non-US traffic from Google Cloud Run lol
Hello, I’m Allie!
If it is GeoIP-based, then it should always be US anyway Though, can't you just prevent Cloud Run from booting anywhere other than the US?
MaxMax
MaxMax10mo ago
Will try to do, but is it the only way to find out if my execution was terminated early?
Hello, I’m Allie!
Assuming that the logs don't show an error, then I don't think it would be getting cut off. Might be something else being skipped in the code If the request goes through, then it has completed execution, so maybe there are some conditions for an API call that aren't being fulfilled
dave
dave10mo ago
Cloud Run is booting only in the US. The thing is if the Worker is running outside of the US, the subrequest to Cloud Run is gonna be outside the US for bandwidth billing purposes, no?
Hello, I’m Allie!
Uh... I'm not actually sure how they determine the "region" it is egressing to, and thus the bill. If it is based on IP geolocation, then all Workers should appear as being from the US As for your original question, if Argo detects that an "origin" is in the US, it will spawn itself there. This does require more than one request per Worker invocation though
Want results from more Discord servers?
Add your server