flowmotion
flowmotion
TTCTheo's Typesafe Cult
Created by flowmotion on 12/30/2023 in #questions
Deploying t3 on netlify?
ok seems to be a netlify issue, as even the repo from the docs doesn't work straigt out of the box and there is some reference error when accessing the server function. Instead of wasting more time with it I decided to use vercel instead. 🤷‍♂️
4 replies
TTCTheo's Typesafe Cult
Created by flowmotion on 12/30/2023 in #questions
Deploying t3 on netlify?
apparently after changing the api.ts file to include a URL env parameter it works almost:
const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url
if (process.env.URL) return `https://${process.env.URL}`; // SSR should use netlify url
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
};
const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url
if (process.env.URL) return `https://${process.env.URL}`; // SSR should use netlify url
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
};
problem now is that netlify seems to use some common js export/require syntax when the package is setup to use esm syntax only.. not sure how to fix this though
4 replies