mw10013
mw10013
Explore posts from servers
CDCloudflare Developers
Created by mw10013 on 6/7/2024 in #pages-help
How to troubleshoot deploy error: `Script startup exceeded CPU time limit`
No description
3 replies
CDCloudflare Developers
Created by mw10013 on 4/4/2024 in #pages-help
Workers paid plan permit pages deploys up to 10MB in size?
Does the workers paid plan ($5/mo) permit pages deploys up to 10mb in size? Or do you need to get the cloudflare pro plan ($20/mo)? The pages limits page (https://developers.cloudflare.com/pages/platform/limits/) does not mention a size for the pages function. The workes limits page (https://developers.cloudflare.com/workers/platform/limits/) mentions 10mb for workers paid plan.
2 replies
CDCloudflare Developers
Created by mw10013 on 12/14/2023 in #workers-help
Can Workers Function use npm packages that use node apis?
I want to use the npm package thirty-two (https://www.npmjs.com/package/thirty-two). It was last published 7 years ago seems to use the Buffer api in node. In wrangler.toml, setting compatibility_flags = [ "nodejs_compat" ] was not enough. I also had to mutate globalThis. Is there a cleaner way to do this? What is the recommended approach to using npm packages that use node apis without an import with the node specifier (eg. import { Buffer } from 'node:buffer)
import * as base32 from 'thirty-two';
import { Buffer } from 'node:buffer';

export default {
async fetch(request: Request, env: {}, ctx: ExecutionContext): Promise<Response> {
globalThis.Buffer = Buffer;
const data = {
encode: base32.encode('node').toString(),
decode: base32.decode('NZXWIZI=').toString(),
};
return new Response(JSON.stringify(data, null, 2));
},
};
import * as base32 from 'thirty-two';
import { Buffer } from 'node:buffer';

export default {
async fetch(request: Request, env: {}, ctx: ExecutionContext): Promise<Response> {
globalThis.Buffer = Buffer;
const data = {
encode: base32.encode('node').toString(),
decode: base32.decode('NZXWIZI=').toString(),
};
return new Response(JSON.stringify(data, null, 2));
},
};
1 replies
CDCloudflare Developers
Created by mw10013 on 12/14/2023 in #workers-help
Workers Playground: load npm packages and specify nodejs_compat compatibility_flags?
Does the Workers Playground have a way to load npm packages and specify nodejs_compat as a compatibility_flag?
2 replies