Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS Database connection #108

Open
selimsezr opened this issue Jul 19, 2024 · 2 comments
Open

NextJS Database connection #108

selimsezr opened this issue Jul 19, 2024 · 2 comments

Comments

@selimsezr
Copy link

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
> <!doctype html>
| <html>
| <head>

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
@mukund-Shukla
Copy link

hi bro did you able to found the solution to this problem? I am also stuck with this from past 3 days

@selimsezr
Copy link
Author

Hi bro. You can check out this link, but since it didn't work for me, I'm using expressjs on the backend side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants