JP
JP
Explore posts from servers
CDCloudflare Developers
Created by JP on 1/22/2024 in #pages-help
Pages returning 500 but the logs say 200 OK?
Can someone help me better understand how CF pages works? I've deployed a barebones remix site using the official remix template: https://github.com/remix-run/remix/tree/main/templates/cloudflare-pages Everything seemed to be working fine until i started receiving a 500 Internal Error in a preview environment. When i go to investigate the logs via wrangler cli and the dashboard. I just see 200 OK responses with a logs: [] entry. I see in the log stream that an entry has an event which looks like my underlying web request because that one has
"response": {
"status": 500
}
"response": {
"status": 500
}
in it. This makes me feel like there is some other place to look for my internal "server" logs?
1 replies
TTCTheo's Typesafe Cult
Created by JP on 12/6/2023 in #questions
Can't reference complex object in server action closure
Can any RSC wizards help me out here? This is very confusing to me, if i change tableSchema to be a primitive it works fine. My guess is that all of the values in the closure are serialized and sent to the client only to be sent back to the server?? If this is indeed what is happening (the error message sucks), where can i learn more about this?
// server-component.tsx
import { createInsertSchema } from "drizzle-zod";
import { posts } from "~/server/db/schema";

export async function ServerComponent() {
const tableSchema = createInsertSchema(posts);

async function action(formData: FormData) {
"use server";
console.log(tableSchema);
// ^^^^ Causes error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components.
// error goes away when commented out
console.log(formData);
}

return (
<div>
{Object.keys(tableSchema.shape).map((key) => (
<div key={key}>{key}</div>
))}
</div>
);
}
// server-component.tsx
import { createInsertSchema } from "drizzle-zod";
import { posts } from "~/server/db/schema";

export async function ServerComponent() {
const tableSchema = createInsertSchema(posts);

async function action(formData: FormData) {
"use server";
console.log(tableSchema);
// ^^^^ Causes error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components.
// error goes away when commented out
console.log(formData);
}

return (
<div>
{Object.keys(tableSchema.shape).map((key) => (
<div key={key}>{key}</div>
))}
</div>
);
}
10 replies
TTCTheo's Typesafe Cult
Created by JP on 11/5/2023 in #questions
Is there a way to load my .env from t3-env in one off scripts?
I believe that is what this issue is asking for? https://github.com/t3-oss/t3-env/issues/97
2 replies