Server actions leaking .env
Ive got some router for generated presigned s3 urls.
router: https://pastebin.com/zSQ4MRjK (its not meant to be a public procedure)
I created an actions file like this:
"use server";
import { api } from "~/trpc/server";
export async function getUploadUrls(
...params: Parameters<typeof api.files.getUploadUrls>
) {
return await api.files.getUploadUrls(...params);
}
But when I import the actions on a client component I get an error.
I create this app using create-t3-app, I dont think I've changes anything about the default procedure.
Pastebin
import { z } from "zod";import { S3Client } from "@aws-sdk/client-s...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

1 Reply
Server actions are mostly for mutating data, not for fetching it. When u want to fetch data you can just query directly from your client components or use a server-caller for calling procedures on the server.
At the same time, none of the code you showed uses your drizzle database or schema, so I would guess that your custom server context, where you add the db to the context for procedures etc., somehow runs on the client somewhere.
If you are using TanStack React Query, please make sure that the
createTRPCContext
method from which you extract useTRPC
etc. comes from the @trpc/tanstack-react-query
package and isn't one you defined in a server environment. If this is not the case, we would likely need more information to identify the problem.