spookily_
spookily_
CDCloudflare Developers
Created by spookily_ on 3/17/2024 in #workers-help
using Mongoose with cloudflare workers?
hey all, i'm trying to create a worker that uses mongodb + mongoose alongside hono, i currently have:
import { Hono } from 'hono';
import { connect } from 'mongoose';

const app = new Hono<{ Bindings: ... } >();
app.use('*', async ctx => {
await connect(ctx.env.MONGO_STRING);
});
import { Hono } from 'hono';
import { connect } from 'mongoose';

const app = new Hono<{ Bindings: ... } >();
app.use('*', async ctx => {
await connect(ctx.env.MONGO_STRING);
});
however, doing this with npx wrangler dev i get the following error:
at null.<anonymous> (file:///home/myproject/worker/src/index.ts:10:8)
at dispatch
(file:///home/myproject/worker/node_modules/hono/dist/compose.js:29:23)
at null.<anonymous>
(file:///home/myproject/worker/node_modules/hono/dist/compose.js:6:12)
at null.<anonymous>
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:188:31)
at Hono2.dispatch
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:198:5)
at Object.fetch
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:201:17)
at __facade_modules_fetch__
(file:///home/myproject/worker/.wrangler/tmp/bundle-7uxxpi/middleware-loader.entry.ts:45:16)
at __facade_invokeChain__
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/common.ts:53:9)
at Object.next
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/common.ts:50:11)
at jsonError
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:30)
at null.<anonymous> (file:///home/myproject/worker/src/index.ts:10:8)
at dispatch
(file:///home/myproject/worker/node_modules/hono/dist/compose.js:29:23)
at null.<anonymous>
(file:///home/myproject/worker/node_modules/hono/dist/compose.js:6:12)
at null.<anonymous>
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:188:31)
at Hono2.dispatch
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:198:5)
at Object.fetch
(file:///home/myproject/worker/node_modules/hono/dist/hono-base.js:201:17)
at __facade_modules_fetch__
(file:///home/myproject/worker/.wrangler/tmp/bundle-7uxxpi/middleware-loader.entry.ts:45:16)
at __facade_invokeChain__
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/common.ts:53:9)
at Object.next
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/common.ts:50:11)
at jsonError
(file:///home/myproject/worker/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:30)
is this supported at all?
3 replies
CDCloudflare Developers
Created by spookily_ on 1/26/2024 in #workers-help
ngrok or similar for workers?
i'm working on an integration for an oAuth provider that requires a non-localhost redirect url, even for its sandbox, so i was wondering if there was a way to get something similar to ngrok with wrangler so that i can work with the oauth provider?
3 replies