does railway support SMTP?
jlew24asu
PROOP

a year ago

I'm trying to deploy a contact us service on my site but I cant get SMTP to work. or at least I think thats the problem. I have no ability to see any useful logs. only thing I see are useless http logs.

Solved

158 Replies

jlew24asu
PROOP

a year ago

04c15714-b519-4459-ac98-c70c2e91f200


a year ago

for SMTP to work you'd need to specify specific ports on Railway metal's proxy which you can't do yet, and even if you could odds are other people would've taken those ports by now

So unfortunately, SMTP servers can't be hosted on Railway


a year ago

not yet anyway, maybe once Railway added custom IPs and the ability to specify a port on TCP


jlew24asu
PROOP

a year ago

so railway doesn't support outgoing SMTP connections?


a year ago

yes we do, there is no restrictions on outbound traffic


jlew24asu
PROOP

a year ago

where can I find logs?


a year ago

logs for what


jlew24asu
PROOP

a year ago

console for example or node server/js logs. there is literally nothing in the "logs" feature besides a few 200 http entries


a year ago

click the deploy logs button


a year ago


jlew24asu
PROOP

a year ago

again, nothing there besides a few http logs


a year ago

screenshot please


jlew24asu
PROOP

a year ago

GET/, POST/ etc. not really helpful. I'm trying to see why email isnt working, despite setting all the variables and code.

this is all there is

HTTP 3/21/2025 12:20:39 AM 100.64.0.4 GET /manifest.json

HTTP 3/21/2025 12:20:39 AM 100.64.0.4 Returned 304 in 1 ms

HTTP 3/21/2025 12:20:39 AM 100.64.0.3 GET /logo192.png

HTTP 3/21/2025 12:20:39 AM 100.64.0.3 Returned 304 in 2 ms

HTTP 3/21/2025 12:20:42 AM 100.64.0.3 POST /api/request-access

HTTP 3/21/2025 12:20:42 AM 100.64.0.3 Returned 200 in 1 ms


a year ago

screenshot please


jlew24asu
PROOP

a year ago

1352438151536312300


a year ago

thats what your app is printing


jlew24asu
PROOP

a year ago

so I cant see console logs?


jlew24asu
PROOP

a year ago

everything I'm doing (with email functions) is working when I test locally. as soon as I deploy to railway, nothing works, despite 200 messages, but I cant see why


a year ago

those are console logs


jlew24asu
PROOP

a year ago

its http logs


a year ago

that is what is being console logged


jlew24asu
PROOP

a year ago

none of this shows up

/ In my request-access.js
router.post('/', async (req, res) => {
consoleAlert('EMAIL REQUEST RECEIVED');
console.log('Request body:', req.body);

try {
const { email } = req.body;
console.log(Received request for email: ${email});

// Email sending logic...
const result = await sendEmail(email);
console.log('Email sending result:', result);

// Success response
console.log('==== EMAIL PROCESS COMPLETED SUCCESSFULLY ====');
return res.json({ success: true });

} catch (error) {
console.log('Error sending email:', error.message);
return res.status(500).json({ error: 'Failed to send email' });
}
});


a year ago

then there is something wrong with your code, unfortunately we wouldn't be able to offer coding assistance here


jlew24asu
PROOP

a year ago

weird that is shows up locally when I run it. but not on railway


jlew24asu
PROOP

a year ago

is there any documentation on how logging works on railway?


jlew24asu
PROOP

a year ago

besides telling me my code sucks


a year ago


jlew24asu
PROOP

a year ago

How it Works
Any build or deployment logs emitted to standard output or standard error ( eg. console.log(…)) are captured by Railway to be viewed or searched later.

i have console.log all over my files. shows up fine locally. but not in railway. maybe more than 1 sentence for "how it works" would be helpful.


a year ago

its as simple as that, you console.log and you will be able to see it in the deploy logs, if you arent theres something wrong with your code, not the platform


jlew24asu
PROOP

a year ago

its literally in the code. and not showing up. ok


jlew24asu
PROOP

a year ago

I followed your extensive documentation to make it work and its not. and your response is, its my problem. we dont know how railway works under the hood. you do


a year ago

I'm sorry but this issue isn't related to the railway platform


jlew24asu
PROOP

a year ago

maybe provide better docs? examples? possible things that cause problems? there is a reason why mine isnt working and I have no idea hwo to make it work on your platform. like I said, it works perfectly fine locally. I cant debug something that works on my end.


a year ago

console.log("message"); would be the example, I'm sorry but that's really all there is to it


a year ago

if you aren't seeing the logs you could be looking at the wrong service


jlew24asu
PROOP

a year ago

console.log('==== EMAIL PROCESS COMPLETED SUCCESSFULLY ===='); all there is to it


jlew24asu
PROOP

a year ago

yea thumbs up. thanks. it doesnt show up


a year ago

I'm sorry you're facing difficulties with your code, but we are only able to offer support for the Railway platform here


a year ago

we have extensive monitoring for our entire logging infrastructure and it's all green


jlew24asu
PROOP

a year ago

I'm not having difficulty with my code. please stop saying that


jlew24asu
PROOP

a year ago

I'm asking for support for this platform and the only response I'm getting is my code sucks


jlew24asu
PROOP

a year ago

I have a mountain of console logs when I run this on localhost. when I deploy to railway, there is nothing


a year ago

at this point all aspects of that platform are operating correctly and without issues.


jlew24asu
PROOP

a year ago

and only you know how it works


a year ago

Yep and I am confidently saying there are no issues on our side at this moment


jlew24asu
PROOP

a year ago

I'm not even saying there is an "issue" with railway. I'm clearly coding exactly how your 1 line of documentation is suggesting, and its not working. its working fine on my end. but to you, its just one big mystery


a year ago

maybe start from the basics? a JavaScript file with only a console log


jlew24asu
PROOP

a year ago

you mean like this?

node test-smtp-connection.js

!!!!! SMTP CONFIGURATION !!!!!

Host: smtp.hostinger.com
Port: 465
Secure: true
User: noreply@spendspace.io

Pass:

!!!!! STARTING SMTP TESTS !!!!!

Network Interfaces:

- Wi-Fi: 192.168.1.89

!!!!! TESTING TCP CONNECTION !!!!!

Attempting to connect to smtp.hostinger.com:465…

TCP connection successful!

!!!!! TESTING TLS CONNECTION !!!!!

Attempting TLS connection to smtp.hostinger.com:465…
TLS connection authorized!
TLS Protocol: TLSv1.3

Cipher: TLSAES256GCMSHA384

!!!!! TESTING SMTP AUTHENTICATION !!!!!

Verifying SMTP connection…
SMTP Verification Result: true


a year ago

I'm sorry but I'm not sure the relevance of that to what I just said


jlew24asu
PROOP

a year ago

those are console logs


a year ago

I'm going to have to step back here and let the community involve themselves with this thread and they can offer you coding assistance if they so choose


jlew24asu
PROOP

a year ago

so you have no idea why those console logs show up locally but not in railway? they are all literally console.log()


jlew24asu
PROOP

a year ago

coding assistance. nice dig


maddsua
HOBBY

a year ago

it's funny how neither of you actually tries to debug the issue


jlew24asu
PROOP

a year ago

I'd love to! thats what logs are for. but I cant see any here


maddsua
HOBBY

a year ago

ok lets start from a different angle


maddsua
HOBBY

a year ago

what prints those $DATE $IP Returned $CODE?


maddsua
HOBBY

a year ago

I would assume it comes from somewhere in your code


jlew24asu
PROOP

a year ago

// Get network information
try {
const { networkInterfaces } = require('os');
const nets = networkInterfaces();
console.log('Network Interfaces:');
for (const name of Object.keys(nets)) {
for (const net of nets[name]) {
if (net.family === 'IPv4' && !net.internal) {
console.log(- ${name}: ${net.address});
}
}


maddsua
HOBBY

a year ago

sooo, there is this annoying issue with docker and stdout buffering


maddsua
HOBBY

a year ago

tldr: if the app doesn't flush the buffer, the logs can appear god knows when


maddsua
HOBBY

a year ago

and this looks like node (I assume you're using it) is getting fucky because of whatever reason


jlew24asu
PROOP

a year ago

yes node. not sure how to "flush the buffer", but its something to figure out and try. thank you


maddsua
HOBBY

a year ago

you can try to just log a ton of nonsense to overwrite that 4KB buffer… but again, it seems like the app actually prints those http requests just fine


vl0022
FREE

a year ago

agreed


vl0022
FREE

a year ago

the logs issue is driving me insane


jlew24asu
PROOP

a year ago

level 1 tech support says to write better code


ayush-lal
HOBBY

a year ago

@ChicagoPhotoShop stop shitting on other people. This is a skill issue on your part and the Railway team have better things to do then help people troubleshoot someone elses code problems…


jlew24asu
PROOP

a year ago

@Ayush I'm not shitting on other people. this is a support forum, I'm seeking support. I'm not the only one having this issue. railway has nearly zero documentation and the only support provided is "write better code". go back to what rock you came out from


ayush-lal
HOBBY

a year ago

@ChicagoPhotoShop - "I'm sorry you're facing difficulties with your code, but we are only able to offer support for the Railway platform here"

I get it, you must be frustrated with your vibe coding issue, but being rude isnt the right way to go about it.


jlew24asu
PROOP

a year ago

ah. railway status is green. sorry, cant help ya. 👍🏻


jlew24asu
PROOP

a year ago

you tell me to stop shitting on people, and they you come here shitting on me. seriously, go smell some grass


ayush-lal
HOBBY

a year ago

<:kekw:788259314607325204>


jlew24asu
PROOP

a year ago

douche


ayush-lal
HOBBY

a year ago

Relax bud, you just need some accountability. All of a sudden, when someone calls you out, then you get defensive and start throwing insults. No one's stopping you from venting, but if you're looking for help, maybe drop the attitude and focus on the issue at hand.


jlew24asu
PROOP

a year ago

calls me out for what?


jlew24asu
PROOP

a year ago

seeking support?


ayush-lal
HOBBY

a year ago

im calling you out for being rude and shitting on the railway team even though its not their responsibility?


jlew24asu
PROOP

a year ago

happy to focus on the issue at hand. what is it that you are doing exactly? seriously, go somewhere else


jlew24asu
PROOP

a year ago

you are calling me out for being rude while being rude yourself. pot meet kettle. go away already christ


ayush-lal
HOBBY

a year ago

You came in here whining, got called out for being rude, and now you're deflecting instead of owning up to it. If you actually want help, act like someone people would want to help. Anyways, I'm done here, good luck 😂


jlew24asu
PROOP

a year ago

you promise?


patod01
HOBBY

a year ago

what;s up


patod01
HOBBY

a year ago

still the "no logs" issues?


jlew24asu
PROOP

a year ago

i do not get console.log() on railway, thats correct. but it doesnt seem like its supported here so I'm moving on. I can see all the logs I need when working locally.


patod01
HOBBY

a year ago

is your app loaded from a docker image?


jlew24asu
PROOP

a year ago

yes


patod01
HOBBY

a year ago

ok


patod01
HOBBY

a year ago

im ready


patod01
HOBBY

a year ago

i'm not an english native, so if you don't understand something I say, let me know to paraphrase myself


patod01
HOBBY

a year ago

indeed, this is all about flush


patod01
HOBBY

a year ago

I made a repo in python, but you can easily translate it to js since it's just a oneline change


patod01
HOBBY

a year ago

when you deploy from docker, it doesn't flush your strings in railway. In a few words, your content is waiting in a buffer before being served


patod01
HOBBY

a year ago

you can force it to be flushed and then the text will appear


patod01
HOBBY

a year ago

changing your code from

1352653005329011000


patod01
HOBBY

a year ago

to

1352653120249008000


patod01
HOBBY

a year ago

what else can make the trick? Adding a jump in your printed or consoleloged text: \n


patod01
HOBBY

a year ago

so here

1352653452584550400


patod01
HOBBY

a year ago

i can see the printed text

1352653667903471600


patod01
HOBBY

a year ago

I'm testing and it works. But doesn't seem to work with the char \n in my case and it waits till the next flushed print


maddsua
HOBBY

a year ago

Most of the server aren't 🤣


patod01
HOBBY

a year ago

so I'm getting these messages swaped

1352654308662841300


maddsua
HOBBY

a year ago

Thing is, node does flush its console logs by default


maddsua
HOBBY

a year ago

Unless something goes wrong with it


patod01
HOBBY

a year ago

python does it too, except when it doesn't 😆 soyou have to force it


patod01
HOBBY

a year ago

well. Adding flush to every print fixes the issue for me and now I got the logs in the correct order

1352656266702491600


patod01
HOBBY

a year ago

it also works fine from CLI

1352656451914563600


patod01
HOBBY

a year ago

and my web site shows glamorously

1352656789904031700


patod01
HOBBY

a year ago

before this, just the error logs were printed. So if you change console.log to console.error, it should work as well


patod01
HOBBY

a year ago

sadly, what @maddsua seems to be right ):

1352657779764101000


patod01
HOBBY

a year ago

I don't have experience with node, but I had the same issue in python and I solved it in this way. Maybe it's a docker thing, so you could try to run without it or use console.error instead


patod01
HOBBY

a year ago

I hope it helps you, @ChicagoPhotoShop


maddsua
HOBBY

a year ago

Yeah, docker has buffered io for stdout but not stderr


jlew24asu
PROOP

a year ago

this is great, thank you @patod01 what does your railway logs panel look like?


maddsua
HOBBY

a year ago

But again, they seem to have those http logs printed just fine


jlew24asu
PROOP

a year ago

I tried console.error too


maddsua
HOBBY

a year ago

To no avail?


jlew24asu
PROOP

a year ago

ironically it works for my backend deployment, not frontend


maddsua
HOBBY

a year ago

Bruh


maddsua
HOBBY

a year ago

Damn node!


patod01
HOBBY

a year ago

if those came from the framework, that may be the reason. I use bottle in python, and the logs in debbug mode were made through other way but print and I have zero lines of code to print the http response codes, so my normal prints didn't work while the logs from bottle did


maddsua
HOBBY

a year ago

Nope, it's this


patod01
HOBBY

a year ago

ah… I'll see it


maddsua
HOBBY

a year ago

That's what I was told anyway


maddsua
HOBBY

a year ago

Ehh just use golang at that point xD


patod01
HOBBY

a year ago

it looks like this

1352660503607906300


patod01
HOBBY

a year ago

no idea of why that gets printed. Maybe is for the strings being made by a back tilde (`) instead of " or '?


maddsua
HOBBY

a year ago

Shouldn't make any difference


patod01
HOBBY

a year ago

I will blame the framework :v


patod01
HOBBY

a year ago

I googled it and I came to the idea of maybe there's an environment var for node that works the same as the case described in the picture for python

1352662224157540600


patod01
HOBBY

a year ago

in case this helps, here is the repo https://gitlab.com/patod01/test-docker. It also has an image you can pull and test from registry.gitlab.com/patod01/test-docker


maddsua
HOBBY

a year ago

Gitlab mentioned <:lfg:786867302888505364>


a year ago

there is nothing wrong with buffers or anything like that.

They have a Dockerfile with this -

CMD ["sh", "-c", "serve -s build -l ${PORT}"]

fwiw they aren't setting a start command elsewhere, serve is the only program being ran.


maddsua
HOBBY

a year ago

<:wat:786868710791053312>


patod01
HOBBY

a year ago

I can't read greek


maddsua
HOBBY

a year ago

Brody got annoyed and peeked into the code


a year ago

yep annoyed since the blame was placed onto the platform


maddsua
HOBBY

a year ago

What's in the name of everything that's holy is that


a year ago

alright, y'all got this now, peace


maddsua
HOBBY

a year ago

You won't even post a correct version of the command?


jlew24asu
PROOP

a year ago

@Brody blame wasnt on "the platform". I was asking for help and only response was write better code.


patod01
HOBBY

a year ago

in brody's defense, he was right. He should't help in code cases 'cause it may be to hard to point out where the problem could be in the code


jlew24asu
PROOP

a year ago

I understand. but not everyone is a pro, and there is no where else to go for support. never was I "blaming" railway. simply asking how it works. something like, "maybe something wrong with docker build" would have helped alot


patod01
HOBBY

a year ago

i understand what you say, but you overstated here what brody said


patod01
HOBBY

a year ago

and seemed like you were very angry for so little


maddsua
HOBBY

a year ago

To be fair the docker file run cmd is… Unusual


jlew24asu
PROOP

a year ago

CMD ["/app/start.sh"]


patod01
HOBBY

a year ago

in any case, idk if this is pro league if we are dealing with bufffered stuff and docker files. I understand that railway is meant for business, so you need some pro background. Not 100%, but something at the end of the day


maddsua
HOBBY

a year ago

What's inside the start.sh


patod01
HOBBY

a year ago

what matters now is that you have plenty material to keep your research! and we know that you have everything to make it work 😄


maddsua
HOBBY

a year ago

Shell scripts can be real fucky when used as launchers


jlew24asu
PROOP

a year ago

great


patod01
HOBBY

a year ago

try running node directly


patod01
HOBBY

a year ago

this is my cmd in the docker file CMD source ../.venv/bin/activate && python rock.py $MODE $PORT


patod01
HOBBY

a year ago

when you run shell scripts, you change the scope where the process is running


jlew24asu
PROOP

a year ago

ok, changing it


jlew24asu
PROOP

a year ago

I apologize @Brody for letting frustration get the best of me. been a long week.


a year ago

!s


Status changed to Solved brody 12 months ago


Loading...