duckdb / duckdb/duckdb-node

NextJS Database connection

Open
#108 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
91
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Hi everyone I'm developing apps with nextjs but I have a connection problem. How can i solve this issue?

```
//api/dbCheck
import { Connection, Database } from "duckdb-async";
import path from "path";

export async function GET() {
const dbPath = path.join(process.cwd(), "duckdb.db");
console.log(dbPath);
async function simpleTest() {

const db = await Database.create(dbPath);

console.log(db.connect());
}

simpleTest();
return Response.json({ message: "Hello, Next.js!" });
}
```

```
⨯ ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:1
Module not found: Can't resolve 'mock-aws-s3'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/duckdb/lib/duckdb-binding.js
./node_modules/duckdb/lib/duckdb.js
./node_modules/duckdb-async/dist/duckdb-async.js
./src/app/api/dbCheck/route.ts
GET /api/dbCheck 500 in 34ms
```

I'm using Cesium so I dont want config webpack. If I dont config webpack, occured this error at below.

```
./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
>
|
|

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/duckdb/lib/duckdb-binding.js
./node_modules/duckdb/lib/duckdb.js
./node_modules/duckdb-async/dist/duckdb-async.js
./src/app/api/dbCheck/route.ts
GET /_next/static/webpack/87abe03ae6e53aae.webpack.hot-update.json 500 in 4143ms
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.