bugstack for JavaScript & TypeScript
The bugstack SDK captures uncaught server errors in Express and Next.js and starts a fix: TypeError, null access, async/await failures, and import errors. It is the crash-capture part of a product that maintains your whole repository.
What JS/TS Errors bugstack Fixes
- TypeError — null/undefined property access (Cannot read properties of undefined)
- x.map is not a function — calling array methods on non-array values
- Missing or wrong local imports — incorrect relative paths, missing named exports
- Unhandled async failures — missing await, unhandled promise rejection
- Next.js server rendering errors — exceptions thrown in server components and server actions
- Next.js route handler errors — runtime failures in API routes and middleware
Install the SDK
Add bugstack to your project with a single command:
npm install bugstack-sdk
Then initialize it in your entry point:
import { bugstack } from 'bugstack-sdk';
bugstack.init({
apiKey: process.env.BUGSTACK_API_KEY,
});
Example Fix
bugstack detects a TypeError caused by accessing a property on null and writes a small fix:
export function getUserName(user) {
return user.profile.name;
}
// Runtime error when user.profile is null:
// TypeError: Cannot read properties
// of null (reading 'name')
export function getUserName(user) {
if (!user?.profile) {
return null;
}
return user.profile.name;
}
What else bugstack does for this repository
The SDK is one part. Once your repository is connected, bugstack also scans your npm packages for known vulnerabilities and outdated versions, scans for secrets, and acts on failed deploys if you host on Render. It scans and reports, and it can open pull requests for what it finds. Those pull requests are switched on per account. Every change arrives as a pull request, and you set how much happens without you.
Related Error Guides
Full installation guide with config reference →
Hand off the upkeep of your JavaScript app
bugstack captures uncaught server errors in production, finds the cause, writes the fix, and opens a pull request in minutes. Your CI runs on every change, and you decide how much happens without you.
Get started with your JavaScript appConnect GitHub. Add the SDK. That's the setup.