ianh
ianh
Explore posts from servers
CDCloudflare Developers
Created by ianh on 5/27/2024 in #workers-help
Can't get CF transform via workers to do anything
Following this guide: https://developers.cloudflare.com/images/transform-images/transform-via-workers/#an-example-worker Using an unbelievably basic worker:
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
const url = new URL(request.url);
const { pathname } = url;
const imageURL = 'https://pub-d6b4cd812c4c423984abcb97395046d5.r2.dev' + pathname;

const options = {
cf: {
image: {
width: '100',
height: '100',
fit: 'cover',
},
},
};

const imageRequest = new Request(imageURL, { headers: request.headers });
return fetch(imageRequest, options);
}
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
const url = new URL(request.url);
const { pathname } = url;
const imageURL = 'https://pub-d6b4cd812c4c423984abcb97395046d5.r2.dev' + pathname;

const options = {
cf: {
image: {
width: '100',
height: '100',
fit: 'cover',
},
},
};

const imageRequest = new Request(imageURL, { headers: request.headers });
return fetch(imageRequest, options);
}
This doesn't seem to do anything, it just sends the full size image through. What am I doing wrong?
23 replies
TtRPC
Created by ianh on 3/18/2024 in #❓-help
Complex type inference on router outputs?
What are the best practices on complex outputs from routers and typing on the FE? We are doing quite a bit of munging of data from multiple sources, so there's no real concept of an upstream "primitive" as there would be in a simple trpc + nextjs + prisma setup. How is everyone doing typing in a scenario like this? It feels brittle to bind a UI element to the response from a router as that will intrinsically bind those two elements together, making the component non-reusable. Is there a typing layer for trpc that sorta behaves like GQL, where you get a meta layer of types from the router responses?
3 replies
CDCloudflare Developers
Created by ianh on 1/8/2024 in #general-help
Is POP/IMAP on the roadmap, or SMTP?
Been really enjoying the Email routing but it's only 1/2 the solution, would very much love to be able to at least do SMTP, or better yet, provide IMAP/POP accounts. Improvmx does this but I'd much rather have all services in the same location. Is this on the roadmap at all?
2 replies
TtRPC
Created by ianh on 12/8/2023 in #❓-help
How to pass through authentication header when using createTRPCProxyClient and RSC?
Hi - we are having a great time with tRPC, and have it working well in a Next14 + React Server Components environment. However, we're seeing that the headers aren't being passed through when a trpc query call is made from within a RSC component via await trcp.profile.me.query() I looked into trying to pass through the headers and there's no way to access the actual headers from the current request, only to add new ones via headers() function. What is the preferred way to pass through auth headers in a client => RSC => trpc.query => server environment?
9 replies
RRailway
Created by ianh on 12/5/2023 in #✋|help
How to use observability?
No description
15 replies
CDCloudflare Developers
Created by ianh on 11/3/2023 in #general-help
Any update on this outage? It's > 24 hours now.
I'm a bit amazed at the size of this outage. Any updates? Much of our product has been down and we have lots of customer support inquiries asking about when this will be up. Nothing on twitter about the outage.
28 replies
RRailway
Created by ianh on 10/25/2023 in #✋|help
Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or
I keep getting intermittent network failures: 3.099 error https://registry.npmjs.org/@fastify/cors/-/cors-8.4.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/usr/local/share/.cache/yarn/v6/npm-@fastify-cors-8.4.0-dc518a5c147141e21d2dd47108ec9ab0bb9b821c-integrity/node_modules/@fastify/cors/test/preflight.test.js'" 3.099 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. 53.51 info There appears to be trouble with your network connection. Retrying...
4 replies
CDCloudflare Developers
Created by ianh on 9/25/2023 in #pages-help
Custom domains always errors with Inactive (Error)
No description
66 replies
CDCloudflare Developers
Created by ianh on 8/13/2023 in #pages-help
Why do pages main branch use yarn 1 but preview branches use yarn 3?
Trying to get our preview branches working and its not honoring the packageManager field for yarn@1, its forcing yarn@3. Why? Our main branch uses yarn@1 no problems
5 replies
CDCloudflare Developers
Created by ianh on 7/25/2023 in #pages-help
Is there an example next.js on pages example repository?
Are there any example repositories which incorporate some sort of api/backend/fetch example? I've been unable to get any of the following working on nextjs/pages: - app directory with fetch - pages directory getServerSideProps - pages/api with edge untime Example which does something more than static text would be helpful, does anything like this exist?
8 replies
CDCloudflare Developers
Created by ianh on 3/19/2023 in #pages-help
Does Pages Build include user-specified ENV vars? They are not showing up
The docs say that builds include env vars: https://developers.cloudflare.com/pages/platform/build-configuration#environment-variables But when I console.log(process.env) the env vars are not there. Can someone from CF confirm that these vars are included during the build step?
13 replies