brumbrum_brum
brumbrum_brum
Explore posts from servers
CDCloudflare Developers
Created by brumbrum_brum on 9/11/2024 in #general-help
AWS Route 53 Alias DNS
I am trying to connect my AWS api gateway to a CF domain using route 53. I have created an alias record inside my route 53 zone pointing to the gateway. The record is of type "A", and has a value of: "d-ID.execute-api.ZONE.amazonaws.com.". When I try and create a DNS record for this in the CF dashboard, I get an error stating that I cannot do it, because the value is not a valid IPV4 adress. What do I do?
19 replies
CDCloudflare Developers
Created by brumbrum_brum on 9/7/2024 in #pages-help
ENV variables with wrangler pages CLI (VITE REACT)
How do I add env variables to a deployment of a pages application? I am writing a github action that is suppossed to deploy my pages application, and I am trying to grap some secrets from the repo, and add them as env variables for the pages. I have tried this:
- name: Deploy to Cloudflare Pages
working-directory: ./apps/frontend
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
MY_VARIABLE: ${{ secrets.MY_VALUE}}
run: |
wrangler pages deploy ./dist --project-name=frontend-preview --branch=main --commit-dirty=true
- name: Deploy to Cloudflare Pages
working-directory: ./apps/frontend
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
MY_VARIABLE: ${{ secrets.MY_VALUE}}
run: |
wrangler pages deploy ./dist --project-name=frontend-preview --branch=main --commit-dirty=true
But MY_VARIABLE does not show up in the pages dashboard. How can this be done?
5 replies
TtRPC
Created by brumbrum_brum on 8/24/2024 in #❓-help
Fastify + TRPC on Vercel
I am having trouble hosting a Fastify + TRPC server on Vercel. I have tried two different vercel.json setups, but they both do not work for each reasons:
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.js"
}
]
}
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.js"
}
]
}
^^^This just shows the built code in the browser, no matter what route I go to.
{
"builds": [{ "src": "./index.js", "use": "@vercel/node" }],
"routes": [{ "src": "/(.*)", "dest": "/" }]
}
{
"builds": [{ "src": "./index.js", "use": "@vercel/node" }],
"routes": [{ "src": "/(.*)", "dest": "/" }]
}
^^This just shows a 404 page from Vercel. This is my index.ts file (Built to index.js):
import { fastifyTRPCPlugin, FastifyTRPCPluginOptions } from "@trpc/server/adapters/fastify";
import { VercelRequest, VercelResponse } from "@vercel/node";
import fastify from "fastify";
import { createContext } from "./context";
import { appRouter, type AppRouter } from "./router";
import dotenv from "dotenv";

export type { AppRouter } from "./router";

dotenv.config();

const server = fastify({});

server.register(fastifyTRPCPlugin, {
prefix: "/",
trpcOptions: {
router: appRouter,
createContext,

onError({ path, error }) {
console.error(`Error in tRPC handler on path '${path}':`, error);
},
} satisfies FastifyTRPCPluginOptions<AppRouter>["trpcOptions"],
});


export default async (req: VercelRequest, res: VercelResponse) => {
await server.ready();
server.server.emit("request", req, res);
};
import { fastifyTRPCPlugin, FastifyTRPCPluginOptions } from "@trpc/server/adapters/fastify";
import { VercelRequest, VercelResponse } from "@vercel/node";
import fastify from "fastify";
import { createContext } from "./context";
import { appRouter, type AppRouter } from "./router";
import dotenv from "dotenv";

export type { AppRouter } from "./router";

dotenv.config();

const server = fastify({});

server.register(fastifyTRPCPlugin, {
prefix: "/",
trpcOptions: {
router: appRouter,
createContext,

onError({ path, error }) {
console.error(`Error in tRPC handler on path '${path}':`, error);
},
} satisfies FastifyTRPCPluginOptions<AppRouter>["trpcOptions"],
});


export default async (req: VercelRequest, res: VercelResponse) => {
await server.ready();
server.server.emit("request", req, res);
};
2 replies
TtRPC
Created by brumbrum_brum on 8/17/2024 in #❓-help
Procedures with paramters.
Is it possible to pass parameters to a procedure in TRPC? I want a procedure that first checks if the user is signed in by default. But then I also want to be able to pass an array of permissions for the user to have, when the actual procedure is used in a route.
9 replies
TtRPC
Created by brumbrum_brum on 6/2/2024 in #❓-help
Generic query type
Does TRPC offer a generic query type? I am thinking of a type where I can control the input/output interface, and then be allowed to pass any query with those interfaces?
2 replies
TtRPC
Created by brumbrum_brum on 3/10/2024 in #❓-help
Not getting "User" type on context.
No description
4 replies