[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# Vercel Bun serverless functions crash with exit status 1 when using path aliases

1 view · 0 likes · 3 posts


Darkstar (@darkstarxdd) · 2026-04-06

I have a simple REST API setup here: [GitHub - DarkstarXDD/hono-bun-on-vercel](https://github.com/DarkstarXDD/hono-bun-on-vercel)

It’s basically the same setup as shown in the official [example](https://github.com/vercel/examples/tree/main/framework-boilerplates/hono-bun).

## Problem
The only difference is that I have couple of extra routes defined and they are imported into the main entry file, which is `src/app.ts`. According to the [docs here](https://vercel.com/docs/frameworks/backend/hono#exporting-the-hono-application), Vercel will automatically pick up `src/app.ts` as an entry point so that is not an issue.

When deployed, the build succeeds. However, every single route is crashing at runtime.

## Current Behavior
The error I get in the runtime logs is:

> **ResolveMessage {} Bun process exited with exit status: 1. The logs above can help with debugging the issue.**

I tried adding an `app.onError` in `Hono`, but that doesn’t seem to hit either. So it’s crashing even before that.

## What I've Tried
This was the only thread I found regarding this issue: [Elysia and Bun serverless function fails with exit status 1 on Vercel](https://community.vercel.com/t/elysia-and-bun-serverless-function-fails-with-exit-status-1-on-vercel/33734)

Since it mentions the issue is because of path aliases, I tried removing the path aliases and replacing them with relative imports. It works then. The serverless functions don’t crash.

However, the actual repo I want to deploy has many imports on each file using path aliases. I would really like to know whether there is a solution for this without removing all my path aliases.

I also tried a few different solutions in this branch: [Comparing main...fix-vercel-crash](https://github.com/DarkstarXDD/hono-bun-on-vercel/compare/main...fix-vercel-crash)

1. Added a `bun build` script to `package.json`:
```bash
"build": "bun build ./src/app.ts --outdir ./dist"
```

2. Updated `vercel.json` as follows:
```json
{
  "bunVersion": "1.x",
  "routes": [{ "src": "/(.*)", "dest": "/dist/app.js" }]
}
```

This gave the same result where the serverless function crashes. I am not sure what I may have done wrong there.


Pauline P. Narvas (@pawlean) · 2026-04-07

Could you try the following?

- Replace all path alias imports (`@/*`) with relative imports (`./` or `../`) - this is the most reliable fix
- Use explicit file extensions in imports (`.ts`, `.tsx`) as Bun sometimes requires them

Let us know how you get on!


Darkstar (@darkstarxdd) · 2026-04-12

Hey, thanks for taking a look. Sorry for the delayed response.

As I mentioned in my post, it will work fine if I remove the path alias and replace them all with relative imports. But I would like to know whether there is a way to get it to work with the path alias? Path alias is a very convinient thing. And I have used it a lot in the project I am trying to deploy. So going and replacing all those import calls with relative imports is a thing I would like to avoid if possible.

Regarding your second option. It won’t work if the file extenions are `.ts` on Bun runtime. It will work if the file extension is `.js`. But for Bun it works even without the file extension as long as path alias is not used, so you don’t need to have any extension at all.

As for the path alias making it break, is it a known limitation? Is it something planned to be fixed?

Also, another question I have is, should I have some sort of build script? Since this is only a REST API built with Hono (no frontend code), I thought I will not need anything extra. Plus the official example doesn’t seem to have any build script either: https://github.com/vercel/examples/tree/main/framework-boilerplates/hono-bun

I tried using the `bun build` command as a build script. So Vercel runs it when it runs `vercel build`. This way all my code gets bundled into one file in `/dist/app.js`, and there won’t be any path alias. And I get to keep the path alias in my source code. But this also breaks at runtime. It outputs the same error I have in my original post. I suspect in this case it’s because the build output is in `/dist/app.js` and Vercel doens’t find it? Because in the docs it says the only files that are supported are these:https://vercel.com/docs/frameworks/backend/hono#exporting-the-hono-application
Because of that I tried ouputting the build output to a place like `/app.js`, but that didn’t work either. Same error.

It’s bit hard to troubleshoot because build passes, and it only fails at runtime and I get the same error on all occasions. I am happy to share and clarify things further if something is not clear.