Feedback: Railway Functions

As part of Launch Week 02, we have shipped Railway Functions

Write and deploy code from the Railway canvas without managing infrastructure or creating a git repository. Functions are Services that run a single file of TypeScript code using the Bun runtime. Use them like any other Service, but without the overhead of a repository.

To make a Function Service, click New Service on the canvas and then click "Function" - you will then see the editor.

They are ideal for small tasks like handling webhooks, cron jobs, or simple APIs. (Or larger ones like cleaning data.)

This is a feedback thread to keep track of asks about this feature.

Some known caveats:

  • You can't railway up your function file

  • 1 file per function

  • Max file size of 96KB

Roast 'em

Completed

0 Threads mention this feature

21 Replies

Status changed to In Progress angelo-railway 11 months ago


andreaselia
PRO

a year ago

Awesome launch! I take it Railway Functions are designed, as you said, for small tasks, rather than something like runnning Puppeteer or anything else which is heavy that requires additional setup for an image install, etc. that can be ran as its own service?


malonehedges
PRO

a year ago

Love Railway, love Bun, and love functions! Love this update!

A couple requests:
- pushing changes from a file on my computer (I'm more comfortable in my editor, I like versioning with GitHub / collaborating, and I want LLMs to write this code for me)
- if not above, LLM help (with some copy/paste instructions on how the import syntax / version pinning works, best practices that make sense for an LLM to have as context when writing one of these functions)
- Vim bindings in the dashboard
- Very clear versioning of Bun, which is less important if Bun is always up to date (Bun releases new features all the time currently, and with Nixpacks in the past I wasn't able to use a new feature and changed my build system to be Docker)

Overall very excited! Thanks Railway team!


markvh033
HOBBY

a year ago

I like it! more examples and documentation will always be appreciated so people can quickly get going.

An issue im running into now is:

error: Failed to start server. Is port 8080 in use?

syscall: "listen",

errno: 0,

code: "EADDRINUSE"

at bun:main:12:28

Another container is already using 8080, but cant find where i can change the port.


Anonymous
TRIAL

a year ago

Does the Railway Function support Python? I have a cron job running Python code and am exploring integration options. Let me know if this is possible.


andreaselia

Awesome launch! I take it Railway Functions are designed, as you said, for small tasks, rather than something like runnning Puppeteer or anything else which is heavy that requires additional setup for an image install, etc. that can be ran as its own service?

Yes, we would say bring an image for that.


Does the Railway Function support Python? I have a cron job running Python code and am exploring integration options. Let me know if this is possible.

Not yet, but it's likely the second language we'd support.


malonehedges

Love Railway, love Bun, and love functions! Love this update!A couple requests:- pushing changes from a file on my computer (I'm more comfortable in my editor, I like versioning with GitHub / collaborating, and I want LLMs to write this code for me)- if not above, LLM help (with some copy/paste instructions on how the import syntax / version pinning works, best practices that make sense for an LLM to have as context when writing one of these functions)- Vim bindings in the dashboard- Very clear versioning of Bun, which is less important if Bun is always up to date (Bun releases new features all the time currently, and with Nixpacks in the past I wasn't able to use a new feature and changed my build system to be Docker)Overall very excited! Thanks Railway team!

jaredlunde
EMPLOYEE

a year ago

This stays between us shh, but you can cmd+option+v or ctrl+alt+v in the editor to enable vim mode.

Thanks for all the feedback : ) We are working on some of these things.


Does the Railway Function support Python? I have a cron job running Python code and am exploring integration options. Let me know if this is possible.

internetjanitor
PRO

10 months ago

co asking because that would be awesome!!!!!


angelo-railway

Not yet, but it's likely the second language we'd support.

internetjanitor
PRO

10 months ago

yes please!


lukashirt
PRO

10 months ago

Great concept! What I would really love is to replace my cron jobs with Railway functions. Currently I have a few simple cron jobs that are only calling API endpoints and if I could schedule a Railway function for this, I would be a happy man. Having to create a GH repo, commit & push the code is of course manageable but if I could just write a simple fetch function, set a schedule and be done with that, that would be something awesome! Unfortunately it says "Cron schedules are not available for serverless services." right now.


lukashirt

Great concept! What I would really love is to replace my cron jobs with Railway functions. Currently I have a few simple cron jobs that are only calling API endpoints and if I could schedule a Railway function for this, I would be a happy man. Having to create a GH repo, commit & push the code is of course manageable but if I could just write a simple fetch function, set a schedule and be done with that, that would be something awesome! Unfortunately it says "Cron schedules are not available for serverless services." right now.

jaredlunde
EMPLOYEE

9 months ago

It's a poorly worded warning, sorry about that. You can certainly use Railway Functions for cron services. You just need to make sure that the "Enable Serverless" setting is off.

Attachments


techgosafeagency
PRO

8 months ago

Hi, I have already opened a thread about this, but there is in the project planning maybe an implementation of an SDK or library to be able to perform actions against the functions (like invoking them or even uploading new functions, or other kind of actions).

Great job out there!


abdallh12345
FREE

6 months ago

https://station.railway.com/feedback/feedback-railway-functions-231e8b94


abdallh12345
FREE

6 months ago


abdallh12345
FREE

6 months ago

https://station.railway.com/feedback/feedback-railway-functions-231e8b94#4k0c


Status changed to Completed chandrika 6 months ago


visionatedigital
FREE

5 months ago

Cannot create code snapshot right now, please review your last commit or try again

If this error persists, please reach out to the Railway team. this error has persisted


planstream-admin
HOBBY

3 months ago

Can we please have Railway Functions with Node.js runtime?


alandotcom
PRO

2 months ago

How can I use a private npm package in a function?


mkvlrn
HOBBY

2 months ago

It would be great to be able to actually version these and deploy via repository. Any kind of convetion for the file itself would work, maybe a main.ts file at the root, or a configurable value, even.

Using the embedded editor is not a great experience.


markwitt1
PRO

2 months ago

Its kind of a dealbreaker that it doesnt support git. it leaves a lot of room for error if there are different environments


zackkrida
PRO

8 days ago

Functions have been great so far--I’ve really enjoyed working with them. I do agree with others that managing and deploying functions directly from a GitHub repo could be smoother.

Until that’s supported, here's a simple pattern I've been using to deploy multiple Railway Functions with GitHub Actions, using the Railway CLI. It walks all directories under functions/* and links + deploys each one automatically.

This works well if you keep each function in its own folder like so:

functions/
  image-proxy/
    index.ts
  resize/
    index.ts

Example workflow step:

deploy-functions:
  needs: detect-changes
  if: needs.detect-changes.outputs.functions == 'true'
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4

    - name: Install Railway CLI
      run: npm install -g @railway/cli

    - name: Link and deploy all functions
      run: |
        for dir in functions/*; do
          if [ -d "$dir" ]; then
            name=$(basename "$dir")

            echo "Deploying function: $name"

            railway functions link \
              --function "$name" \
              --path "$dir/index.ts"

            railway functions push \
              --path "$dir/index.ts"
          fi
        done
      env:
        RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

Things to note:

  • Each subdirectory name is used as the Railway function name (functions/<name>/index.ts).

  • This pairs nicely with a change-detection step so you only deploy when something under functions/ changes.

  • You’ll need a RAILWAY_TOKEN secret set in your repo (docs for creating one here).

Hopefully this helps anyone who wants CI-driven function deploys until first-class GitHub support lands!


Loading...