asheeshh
asheeshh
Explore posts from servers
TTCTheo's Typesafe Cult
Created by asheeshh on 9/2/2023 in #questions
throwing custom errors from trpc mutations
No description
4 replies
TtRPC
Created by asheeshh on 9/2/2023 in #❓-help
throwing custom errors from mutations
No description
21 replies
TTCTheo's Typesafe Cult
Created by asheeshh on 10/28/2022 in #questions
Next.js API route error in prod
so, basically I have an API route which throws error (500) only in prod, it works fine on dev server, I even built the app locally but it works just fine. Code -
import type { NextRequest } from "next/server";
import { getAnalytics } from "../../lib/umami";

export const config = {
runtime: "experimental-edge",
};

type UmamiResponse = {
pageviews: {
value: number;
};
uniques: {
value: number;
};
};

export default async function handler(req: NextRequest) {
const resp = await getAnalytics();
const analytics = (await resp.json()) as UmamiResponse;

return new Response(JSON.stringify(analytics), {
status: 200,
headers: {
"Content-Type": "application/json",
"cache-control": "public, s-maxage=60, stale-while-revalidate=30",
},
});
}
import type { NextRequest } from "next/server";
import { getAnalytics } from "../../lib/umami";

export const config = {
runtime: "experimental-edge",
};

type UmamiResponse = {
pageviews: {
value: number;
};
uniques: {
value: number;
};
};

export default async function handler(req: NextRequest) {
const resp = await getAnalytics();
const analytics = (await resp.json()) as UmamiResponse;

return new Response(JSON.stringify(analytics), {
status: 200,
headers: {
"Content-Type": "application/json",
"cache-control": "public, s-maxage=60, stale-while-revalidate=30",
},
});
}
4 replies