AGill
AGill
Explore posts from servers
CDCloudflare Developers
Created by Nitish on 3/26/2024 in #r2
can i do something i will 2 copies of
^ endpoint is /images/[pathname].ts where [pathname] is the R2 prefix + filename
5 replies
CDCloudflare Developers
Created by Nitish on 3/26/2024 in #r2
can i do something i will 2 copies of
Hey did you guys figure this out? I'm also trying to serve images from my R2 bucket but I want to resize them on demand. My app is using NuxtJS and I have a dedicated API endpoint in my app to serve the R2 image. the return response the endpoint is the object.body of the R2 object which is type ReadableStream
export default eventHandler(async (event) => {
const { pathname: normalizedPathname } = event.context.params || {};

const pathname = denormalizePath(normalizedPathname);

await authorizeR2ObjectRequest(event, pathname);

const object = await assertObject(event, pathname);

const contentType
= object.httpMetadata?.contentType || getContentType(pathname);

setHeader(event, 'Content-Type', contentType);
setHeader(event, 'Content-Length', object.size);
setHeader(event, 'etag', object.httpEtag);
setHeader(event, 'Content-Security-Policy', 'default-src \'none\';');

return object.body;
});
export default eventHandler(async (event) => {
const { pathname: normalizedPathname } = event.context.params || {};

const pathname = denormalizePath(normalizedPathname);

await authorizeR2ObjectRequest(event, pathname);

const object = await assertObject(event, pathname);

const contentType
= object.httpMetadata?.contentType || getContentType(pathname);

setHeader(event, 'Content-Type', contentType);
setHeader(event, 'Content-Length', object.size);
setHeader(event, 'etag', object.httpEtag);
setHeader(event, 'Content-Security-Policy', 'default-src \'none\';');

return object.body;
});
5 replies
NNuxt
Created by BiffBaffBoff on 9/6/2024 in #❓・help
Cloudflare pages preset
lol fair point I ended up using jsquash: https://github.com/jamsinclair/jSquash
3 replies
NNuxt
Created by BiffBaffBoff on 9/6/2024 in #❓・help
Cloudflare pages preset
I was able to deploy sharp -- see issues comment: https://github.com/lovell/sharp/issues/4113#issuecomment-2560374164 But now I'm getting some runtime errors so I need to figure that out:
Could not load the \"sharp\" module using the linuxnull-undefined runtime\nundefined: Could not dynamically require \"../src/build/Release/sharp-linuxnull-undefined.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"../src/build/Release/sharp-wasm32.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"@img/sharp-linuxnull-undefined/sharp.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"@img/sharp-wasm32/sharp.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nPossible solutions:\n- Manually install libvips >= 8.15.3\n- Add experimental WebAssembly-based dependencies:\n npm install --cpu=wasm32 sharp\n npm install @img/sharp-wasm32\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install\n"
Could not load the \"sharp\" module using the linuxnull-undefined runtime\nundefined: Could not dynamically require \"../src/build/Release/sharp-linuxnull-undefined.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"../src/build/Release/sharp-wasm32.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"@img/sharp-linuxnull-undefined/sharp.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: Could not dynamically require \"@img/sharp-wasm32/sharp.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nPossible solutions:\n- Manually install libvips >= 8.15.3\n- Add experimental WebAssembly-based dependencies:\n npm install --cpu=wasm32 sharp\n npm install @img/sharp-wasm32\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install\n"
3 replies
CDCloudflare Developers
Created by Alsososcar on 11/28/2024 in #workers-help
Process data, then upload to Neon without going to page?
3 replies
CDCloudflare Developers
Created by Alsososcar on 11/28/2024 in #workers-help
Process data, then upload to Neon without going to page?
should be feasible with workers yes
3 replies
CDCloudflare Developers
Created by Josh on 10/7/2024 in #pages-help
Running with a newer version of Node - env var not being passed through?
I'm having the same issue: https://discord.com/channels/595317990191398933/1291619831870656584 And also https://discord.com/channels/595317990191398933/1288937653537869979 By recreate deployment, do you mean deleting the pages project entirely? and recreating? Because I've also tried re-deploying within the same project to no avail.
4 replies
CDCloudflare Developers
Created by Lune on 10/4/2024 in #workers-help
Puppeeter with cloudflare workers
The cloudflare browser rendering API is the infra (AKA Binding) that runs the puppeteer instance for you. And the @cloudflare/puppeteer package is what you install in your app to use the binding.
4 replies
CDCloudflare Developers
Created by AGill on 10/4/2024 in #pages-help
[Nuxt] Unable to load env vars when nodejs_compat flag enabled
4 replies
CDCloudflare Developers
Created by AGill on 10/4/2024 in #pages-help
[Nuxt] Unable to load env vars when nodejs_compat flag enabled
I see thanks for sharing. Unfortunately I'm stuck waiting because I need nodejs_compat_v2 (or nodejs_compat + compatibility_date > 2024-09-23) since I want to use the Browser rendering API.
4 replies
CDCloudflare Developers
Created by AGill on 9/24/2024 in #general-help
Just Purchased Workers Paid Plan but dashboard shows free plan still
No description
5 replies
CDCloudflare Developers
Created by AGill on 9/24/2024 in #general-help
Just Purchased Workers Paid Plan but dashboard shows free plan still
I opened a support case so I will wait on a response from there.
5 replies
CDCloudflare Developers
Created by AGill on 9/24/2024 in #general-help
Just Purchased Workers Paid Plan but dashboard shows free plan still
hm I see there is an on going incident: https://www.cloudflarestatus.com/incidents/40wylr6fxlky
5 replies
CDCloudflare Developers
Created by AGill on 6/23/2024 in #r2
Hey guys I'm `PUT`ing into my R2 bucket
ok figured it out I was importing types from @cloudflare/workers-types path; I have to import from @cloudflare/workers-types/experimental
5 replies
CDCloudflare Developers
Created by AGill on 6/23/2024 in #r2
Hey guys I'm `PUT`ing into my R2 bucket
I'm using @cloudflare/workers-types version 4.20240512.0
5 replies