tRPC and WebSockets
how can I dynamically import env from
/env/server/mjs
?
ts-node-dev --project tsconfig.server.json --respawn --transpile-only --ignore-watch node_modules --no-notify --exit-child src/server/wsServer.ts
19 Replies
I am trying to compile wsServer.ts
@wsServer.ts
Hey @SeanCassiere any idea about this?
I don't think you can
dynamically
import your env vars.
Question, is this a standard Node tRPC server? or one using NextJS?
Because you can't run Websocket servers on NextJS due it being serverless/lambdas
i believe it doesn't use next js
Ok, then that shouldn't be an issue then.
FYI, an easy way if checking yours is a Next project, is too if there is a next.config.js
in your project root.
Other than that there's no reason it shouldn't work. Although I don't see your import statement in the code either.
What's the actual issue here, maybe I'm just a bit confused š¤it is using
createContext
TomDoesTech
YouTube
Build a Live Chat Application with the T3 Stack - TypeScript, Tailw...
Repository: https://github.com/TomDoesTech/t3-chat
In this view, we build a live chat application with the T3 stack, tRPC, Tailwind & TypeScript.
š Follow me here:
Discord: https://discord.gg/4ae2Esm6P7
Twitter: https://twitter.com/tomdoes_tech
Facebook: https://www.facebook.com/tomdoestechā
Instagram: https://www.instagram.com/tomdoestechā
Ti...
i am trying to follow this video
Normally it shouldn't affect it, that seems odd š¤
Not sure what you are doing in the createContext, but that seems like a weird af bug.
but i think he is using old version of t3 create app
Quite possibly, and FYI that's a NextJS project.
yea i know
Are you running into this issue in dev, or prod btw?
dev
Seems quite weird.
I'm unable to clone the repo and try it out or anything, as I'm out of the house, but I'm interested to see where this goes.
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
@flicknote I am getting Invalid Environment Variable error
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
yea I figured when I run nextjs with
yarn dev
i don't actually set it manually neither yarn dev sets it (next dev
sets it to dev under the hood i guess)
after I added the NODE_ENV=development
to .env
it works now
thanksUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View