Skip to content

Cloudflare Workers support (maybe via a HTTP Driver) #14613

Open

Description

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.4.0

Node.js version

20.11.1

MongoDB server version

7.0.8

Typescript version (if applicable)

No response

Description

i was trying to use mongodb with honojs and i have installed mongoos but
connectDB function is showing the error import_mongoose.default.connect is not a function

import { z } from "zod";
import mongoose from "mongoose";

import { USERS } from "./index.js";

// this function
async function connectDB(url: string) {
  await mongoose.connect(String(url));
}

log

Error in connecting to DB TypeError: import_mongoose.default.connect is not a function
    at connectDB (file:///home/user/hono_tododb/src/utils.ts:7:18)
    at null.<anonymous> (file:///home/user/hono_tododb/src/index.ts:26:13)
    at dispatch (file:///home/user/hono_tododb/node_modules/hono/dist/compose.js:29:23)
    at null.<anonymous> (file:///home/user/hono_tododb/node_modules/hono/dist/compose.js:30:20)
    at cors2 (file:///home/user/hono_tododb/node_modules/hono/dist/middleware/cors/index.js:65:11)
    at dispatch (file:///home/user/hono_tododb/node_modules/hono/dist/compose.js:29:23)
    at null.<anonymous> (file:///home/user/hono_tododb/node_modules/hono/dist/compose.js:6:12)
    at null.<anonymous> (file:///home/user/hono_tododb/node_modules/hono/dist/hono-base.js:188:31)
    at Hono2.dispatch (file:///home/user/hono_tododb/node_modules/hono/dist/hono-base.js:198:5)
    at Hono2.fetch (file:///home/user/hono_tododb/node_modules/hono/dist/hono-base.js:201:17)

Steps to Reproduce

import { z } from "zod";
import mongoose from "mongoose";

import { USERS } from "./index.js";

// this function
async function connectDB(url: string) {
  await mongoose.connect(String(url));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions