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

Use mongodb, can't new MongoClient #1479

Closed
CooLNuanfeng opened this issue Jul 23, 2023 · 2 comments
Closed

Use mongodb, can't new MongoClient #1479

CooLNuanfeng opened this issue Jul 23, 2023 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists needs reproduction

Comments

@CooLNuanfeng
Copy link

Environment

node: v16.14.0
nitropack: lastest

Reproduction

import { MongoClient } from 'mongodb'

export default cachedEventHandler(async (event)=>{
const { page, pageSize = 10 } = getQuery(event)

// Connection URL
const mongoUrl = 'mongodb://localhost:27017';
console.log('aaaa')
const client = new MongoClient(mongoUrl);
console.log('bbbb')
await client.connect();
const db = client.db('mydb');
const collection = `db.collection('list');

......

Describe the bug

[nitro] [request error] [unhandled] mongodb_connection_string_url_1.default is not a constructor

Additional context

No response

Logs

No response

@Hebilicious
Copy link
Contributor

Possibly duplicate #949 #1024

@Hebilicious Hebilicious added the bug Something isn't working label Jul 23, 2023
@itpropro itpropro added the duplicate This issue or pull request already exists label Aug 24, 2023
@itpropro
Copy link
Contributor

itpropro commented Aug 24, 2023

Hi @CooLNuanfeng,
please check the nitro docs for limitations with worker-like environments.
We can reopen the issue if you have a non-worker environment as target and if you could provide a reproduction repo for us to understand the issue better, especially including nitro config 🙏🏼
PS: Please not that the current LTS version of node is 18, which is the main target for compatibility testing, which is probably not connected to this issue in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists needs reproduction
Projects
None yet
Development

No branches or pull requests

3 participants