What version of Bun is running?
1.0.21+837cbd60d
What platform is your computer?
macos x64
What steps can reproduce the bug?
using an express server with remix
take the bun create remix and make root.tsx:
import { cssBundleHref } from "@remix-run/css-bundle";
import type { LinksFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
];
export class RowsNotFound extends Error {
constructor() {
super("rows not found")
// capturing the stack trace keeps the reference to your error class
Error.captureStackTrace(this, this.constructor)
}
}
export async function yeh() {
throw new RowsNotFound()
}
export async function loader() {
await yeh()
return null
}
export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
}
and run it from an express server like:
import * as dotenv from 'dotenv'
dotenv.config()
import express from 'express'
import { v4 as uuidv4 } from 'uuid'
import cors from 'cors'
import { createRequestHandler } from "@remix-run/express"
import { broadcastDevReady } from "@remix-run/node"
import * as build from "build/index.js"
import sourceMapSupport from "source-map-support"
sourceMapSupport.install(
const listenPort = process.env.PORT || '8080'
async function main() {
const app = express()
app.use(express.json())
app.disable('x-powered-by')
app.use(cors())
// Remix public
app.use(express.static("public"))
app.get('/hc', (req, res) => {
res.sendStatus(200)
})
// Everything else we send to the frontend
app.all("*", createRequestHandler({ build: build as any }))
const server = app.listen(listenPort, () => {
if (process.env.NODE_ENV === "development") {
broadcastDevReady(build as any)
}
logger.info(`API listening on port ${listenPort}`)
})
let stopping = false
process.on('SIGTERM', async () => {
if (!stopping) {
stopping = true
logger.warn('Received SIGTERM command, shutting down...')
server.close()
logger.info('exiting...')
process.exit(0)
}
})
process.on('SIGINT', async () => {
if (!stopping) {
stopping = true
logger.warn('Received SIGINT command, shutting down...')
server.close()
logger.info('exiting...')
process.exit(0)
}
})
}
main()
What is the expected behavior?
Sourcemaps work
What do you see instead?
TypeError: Column must be greater than or equal to 0, got -1
at SourceMapConsumer_findMapping (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:591:69)
at SourceMapConsumer_originalPositionFor (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:662:10)
at mapSourcePosition (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:28:1)
at wrapCallSite (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:398:7)
at prepareStackTrace (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:449:55)
at captureStackTrace (native:1:1)
at new RowsNotFound (/Users/dangoodman/code/sellmyai/src/remix/routes/dashboard.settings.tsx:274:11)
Additional information
Seems to work fine in the root bun create remix where it starts their express server, but it's run with node
The sources I get if I log (based on below comment):
/Users/dangoodman/code/sellmyai/build/index.js
/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js
/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js
full error:
/Users/dangoodman/code/sellmyai/build/index.js
583 | if (aNeedle[aLineName] <= 0) {
584 | throw new TypeError('Line must be greater than or equal to 1, got '
585 | + aNeedle[aLineName]);
586 | }
587 | if (aNeedle[aColumnName] < 0) {
588 | throw new TypeError('Column must be greater than or equal to 0, got '
^
TypeError: Column must be greater than or equal to 0, got -1
at SourceMapConsumer_findMapping (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:588:13)
at SourceMapConsumer_originalPositionFor (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:653:17)
at mapSourcePosition (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:244:28)
at wrapCallSite (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:397:20)
at prepareStackTrace (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:446:39)
at new RowsNotFound (/Users/dangoodman/code/sellmyai/build/index.js:550:30)
at /Users/dangoodman/code/sellmyai/build/index.js:2503:11
at processTicksAndRejections (:61:77)
/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js
/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js
586 | }
587 | if (aNeedle[aColumnName] < 0) {
588 | throw new TypeError('Column must be greater than or equal to 0, got '
589 | + aNeedle[aColumnName]);
590 | }
591 |
^
TypeError: Column must be greater than or equal to 0, got -1
at SourceMapConsumer_findMapping (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:591:69)
at SourceMapConsumer_originalPositionFor (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js:662:10)
at mapSourcePosition (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:28:1)
at wrapCallSite (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:398:7)
at prepareStackTrace (/Users/dangoodman/code/sellmyai/node_modules/source-map-support/source-map-support.js:449:55)
at captureStackTrace (native:1:1)
at new RowsNotFound (/Users/dangoodman/code/sellmyai/src/remix/routes/dashboard.settings.tsx:302:13)
What version of Bun is running?
1.0.21+837cbd60d
What platform is your computer?
macos x64
What steps can reproduce the bug?
using an express server with remix
take the
bun create remixand make root.tsx:and run it from an express server like:
What is the expected behavior?
Sourcemaps work
What do you see instead?
Additional information
Seems to work fine in the root
bun create remixwhere it starts their express server, but it's run with nodeThe sources I get if I log (based on below comment):
full error: