R
Railway3mo ago
FelixNg

NextJS app not connecting to OTel collector

No matter what I try, I could not get it to work
No description
36 Replies
Percy
Percy3mo ago
Project ID: f5c73930-7763-4f58-ae1b-eb1d2215f7e2
FelixNg
FelixNg3mo ago
f5c73930-7763-4f58-ae1b-eb1d2215f7e2 The same set up works locally
Brody
Brody3mo ago
deploying with nixpacks or dockerfile?
FelixNg
FelixNg3mo ago
nextjs is dockerfile, and the otel stack i'm using this template https://railway.app/template/7KNDff
FelixNg
FelixNg3mo ago
i also changed this part for the collector so it fits the package @vercel/otel which is what i'm using
No description
FelixNg
FelixNg3mo ago
but i'm not understanding why my nextjs container is not reaching otel collector in the private network
Brody
Brody3mo ago
is the dockerfile alpine based?
FelixNg
FelixNg3mo ago
for nextjs? oh is that related to the networking thingy with alpine images?
Brody
Brody3mo ago
yeah does the nextjs app deploy with an alpine based dockerfile?
FelixNg
FelixNg3mo ago
yeah brah ur the doctor rebuilding it now
Brody
Brody3mo ago
any luck?
FelixNg
FelixNg3mo ago
seems to work but i went on a tangent
No description
FelixNg
FelixNg3mo ago
i saw on the docs that you can use private url to reduce latency, so tryna doing with redis the thing is tat
Brody
Brody3mo ago
ioredis?
FelixNg
FelixNg3mo ago
No description
Brody
Brody3mo ago
yeah but why do you need redis during build?
FelixNg
FelixNg3mo ago
idek, it's just a weird thing with the node-redis library where u have to explicitly call connect() before doing anything
Brody
Brody3mo ago
if you get errors always show me them, otherwise im just guessing
FelixNg
FelixNg3mo ago
sorry that wasn't the right context
FelixNg
FelixNg3mo ago
No description
FelixNg
FelixNg3mo ago
i have this issue after switching to REDIS_PRIVATE_URL
Brody
Brody3mo ago
yeah why are you connecting to redis during build?
FelixNg
FelixNg3mo ago
i think nextjs compiler steps thru the code during build and it triggers that connect() function. but i need that there so i can maintain a connection with redis i haven't figured out another solution
Brody
Brody3mo ago
dynamically swap between public and private urls then
FelixNg
FelixNg3mo ago
alr i got it to work
Brody
Brody3mo ago
awesome
FelixNg
FelixNg3mo ago
the fix was just simply this
No description
FelixNg
FelixNg3mo ago
and the traces are coming thru jaeger nicely thank you very much! i really appreciate it
Brody
Brody3mo ago
awesome, happy to help where I can
FelixNg
FelixNg3mo ago
the last one lol, do u know how to secure jaeger and prometheus ui? proxy/oauth sidecar?
Brody
Brody3mo ago
I've never used that stack before, it's Melissa's template right?
FelixNg
FelixNg3mo ago
yeas
Brody
Brody3mo ago
okay I'll ask her next week or even better, you can ask her directly https://help.railway.app/feedback/docs-deploy-an-otel-collector-c8a9bf18
FelixNg
FelixNg3mo ago
ooh right, i'll do that
Brody
Brody3mo ago
yeah railways documentation pages all come with an accompanying help thread!
FelixNg
FelixNg3mo ago
just noticed that, really nice