question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoError: "Invalid response header"

See original GitHub issue

Hi, I’m trying connect to MongoDb Atlas.

On localhost everything is OK, but when I deploy project on Deno Deploy it throw this error: Error: MongoError: "Invalid response header" at WireProtocol.receive (https://deno.land/x/mongo@v0.29.3/src/protocol/protocol.ts:77:38)

err

I already have on Mongo network access with Deno Deploy IP.

This is my usage of your module: mongodb.ts

import { MongoClient } from "./deps.ts";
import "https://deno.land/x/dotenv@v3.2.0/load.ts";
const client = new MongoClient();

const MONGO_URI = Deno.env.get("MONGO_URI");
const db = await client.connect(MONGO_URI ? MONGO_URI : "");

export default db;

app.ts

import db from "../mongodb.ts";
const usersCollection = db.collection<IUserModel>("users");

export const authLogin = async(ctx: Context) =>
{
  if (!ctx.request.hasBody) ctx.throw(Status.BadRequest, "Bad Request");

  const model = await ctx.request.body().value;
  if (!model) ctx.throw(Status.BadRequest, "Bad Request");

  const user = await usersCollection.findOne(
    { email: model.email },
    { noCursorTimeout: false }
  );
 ... // more code
}

As I say on localhost, everything works, but when I deploy it, it throw Crash Report.

Any idea how to solve this?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
erfaniumcommented, Jun 16, 2022
0reactions
BrunoBernardinocommented, Jun 16, 2022

I also have this problem sporadically with M2 in Cloud Atlas. I think it’s when the primary server in the cluster switches, but basically for a few minutes this error shows up and blocks everything.

If there’s something I can do to improve support on this, I’m happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Header error in saving a new entry in MongoDB by using ...
The reason for this issue is you are sending response to client twice. If there is an error you should return it as...
Read more >
Issues · denodrivers/mongo - GitHub
MongoDB driver for Deno. Contribute to denodrivers/mongo ... Should we deprecate this module since importing with npm:mongodb is working well with Deno?
Read more >
Administration Login fails, is something wrong with my Function?
Hello, I try to use the Realm Administration API and this is the function for getting the token. async function cloudLogin() { const ......
Read more >
Azure Cosmos DB for Gremlin response headers
Header Type Sample Value When Included x‑ms‑request‑charge double 11.3243 Success and Failure x‑ms‑total‑request‑charge double 423.987 Success and Failure x‑ms‑server‑time‑ms double 13.75 Success and Failure
Read more >
HTTP security headers: An easy way to harden your web ...
Modern browsers support a wide array of HTTP headers that can improve ... hashes of valid certificate public keys for future communication.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found