apache / apache/pouchdb

PouchDB in Nextjs throws error

Open
#8,754 16 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue
Whenever I try running my nextjs app using pouchDB (I am only using it on the server side and **NOT** on the client side) I get
image

Am I missing something?

### Info
- Environment: (Nextjs (backend code Node.js))
- Platform: (Brave)
- Adapter: (leveldb)
- Server: (no server, I am working in local with in nextjs)

### Reproduce
Initi a nextjs app. Setup pouchDB
```
import PouchDB from "pouchdb-node";
const db = new PouchDB("llmshare");
export default db;
```

use pouchDB in any API's `route.ts`
```
import { NextResponse } from "next/server";
import db from "@/db/pouchDB";

export async function GET() {
try {
const res = await db.post({ title: "new code" });

return NextResponse.json({ id: res.id });
} catch (e) {
console.log({ e });
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.