hob8yte
hob8yte
CDCloudflare Developers
Created by hob8yte on 6/4/2024 in #logs-engine
Enable Cloudflare R2 · Cloudflare Logs d...
I've done this all through the dashboard so no relevant wrangler version, but my project uses 3.53.0 right now
5 replies
CDCloudflare Developers
Created by hob8yte on 6/4/2024 in #logs-engine
Enable Cloudflare R2 · Cloudflare Logs d...
@kagitac I believe this is the job id: e8f923579d7c64e7ab5a0447eaf7661a
5 replies
CDCloudflare Developers
Created by hob8yte on 6/4/2024 in #logs-engine
Enable Cloudflare R2 · Cloudflare Logs d...
Yes but not at my computer right now. I will a bit later, thanks!
5 replies
CDCloudflare Developers
Created by hob8yte on 5/6/2024 in #workers-help
Messages in Queue not Processing
Nope :/
11 replies
CDCloudflare Developers
Created by hob8yte on 5/6/2024 in #workers-help
Messages in Queue not Processing
Adding more context. Looks like CPU time is exceeded:
Queue recipe-scrape-queue (1 message) - Exceeded CPU Limit @ 5/6/2024, 9:01:09 AM
(log) PROCESSING MESSAGE https://www.instagram.com/reel/C6TxYW1OjAf
(log) closing websocket
✘ [ERROR] TypeError: Fetch API cannot load:
Queue recipe-scrape-queue (1 message) - Exceeded CPU Limit @ 5/6/2024, 9:01:09 AM
(log) PROCESSING MESSAGE https://www.instagram.com/reel/C6TxYW1OjAf
(log) closing websocket
✘ [ERROR] TypeError: Fetch API cannot load:
Which is odd because generally this only takes ~15 seconds when testing locally
11 replies
CDCloudflare Developers
Created by hob8yte on 5/6/2024 in #workers-help
Messages in Queue not Processing
This was working yesterday and seemed to just stop this morning after trying out inserting a handful of items in the queue all at once.
11 replies
CDCloudflare Developers
Created by hob8yte on 5/6/2024 in #workers-help
Messages in Queue not Processing
No description
11 replies
CDCloudflare Developers
Created by no1ne7576 on 5/6/2024 in #workers-help
browser rendering
Cloudflare has some pretty strict limits about how many browsers you can spin up each minute, which is two. Fortunately you can reuse browser sessions. More on limits: https://developers.cloudflare.com/browser-rendering/platform/limits/ I'm working around this by attempting to connect to a random available session, or else spinning up a new browser.
import puppeteer, { type BrowserWorker } from "@cloudflare/puppeteer";

/**
* Cloudflare Browser Rendering has strict limits on the number of browsers that can be active, but does
* allow sharing sessions. Sessions are active for sixty seconds after the last command is made. New
* browsers can be created at any time, but only two are allowed a minute.
*
* This will try to connect to an available session if one is available, otherwise it will create a new
* browser. If no browser is available, it will throw an error.
*/
export async function getPuppeteerBrowser(browserWorker: BrowserWorker) {
const availableSession = await getAvailableSession(browserWorker);

if (availableSession) {
return await puppeteer.connect(browserWorker, availableSession.sessionId);
}

return await aquireBrowser(browserWorker);
}

async function getAvailableSession(browserWorker: BrowserWorker) {
const activeSessions = await puppeteer.sessions(browserWorker);
const availableSessions = activeSessions.filter(
(session) => !session.connectionId,
);

if (availableSessions.length === 0) {
return undefined;
}

return availableSessions[
Math.floor(Math.random() * availableSessions.length)
];
}

async function aquireBrowser(browserWorker: BrowserWorker) {
const activeLimits = await puppeteer.limits(browserWorker);

if (activeLimits.timeUntilNextAllowedBrowserAcquisition) {
throw new Error("No available browser aquisitions.");
}

return await puppeteer.launch(browserWorker);
}
import puppeteer, { type BrowserWorker } from "@cloudflare/puppeteer";

/**
* Cloudflare Browser Rendering has strict limits on the number of browsers that can be active, but does
* allow sharing sessions. Sessions are active for sixty seconds after the last command is made. New
* browsers can be created at any time, but only two are allowed a minute.
*
* This will try to connect to an available session if one is available, otherwise it will create a new
* browser. If no browser is available, it will throw an error.
*/
export async function getPuppeteerBrowser(browserWorker: BrowserWorker) {
const availableSession = await getAvailableSession(browserWorker);

if (availableSession) {
return await puppeteer.connect(browserWorker, availableSession.sessionId);
}

return await aquireBrowser(browserWorker);
}

async function getAvailableSession(browserWorker: BrowserWorker) {
const activeSessions = await puppeteer.sessions(browserWorker);
const availableSessions = activeSessions.filter(
(session) => !session.connectionId,
);

if (availableSessions.length === 0) {
return undefined;
}

return availableSessions[
Math.floor(Math.random() * availableSessions.length)
];
}

async function aquireBrowser(browserWorker: BrowserWorker) {
const activeLimits = await puppeteer.limits(browserWorker);

if (activeLimits.timeUntilNextAllowedBrowserAcquisition) {
throw new Error("No available browser aquisitions.");
}

return await puppeteer.launch(browserWorker);
}
4 replies
CDCloudflare Developers
Created by hob8yte on 4/30/2024 in #workers-help
Custom CA for Worker
Yeah, it's pretty unfortunate because it's such an essential feature for my company. Seems like workers are great when you're putting everything in your tech stack in the cloudflare environment, but it's not so great trying to integrate with older systems.
3 replies
CDCloudflare Developers
Created by kingmesal on 4/25/2024 in #workers-help
worker failed to prewarm
Deploying an application that uses browser rendering and queues pretty heavily. Hope the local/remote DX improves soon
4 replies
CDCloudflare Developers
Created by kingmesal on 4/25/2024 in #workers-help
worker failed to prewarm
Thanks for leaving this note, just helped me stop pulling my hair out hah
4 replies