ERR_EMPTY_RESPONSE on MongoDB atlas

Hello,
I have a problem with the connexion with the server.

My navigator (Chrome) return ERR_EMPTY_RESPONSE when I want to send a POST request. My URL seems to be good on the request and on the config.

        await fetch("https://ac-***-shard-00-01.****.mongodb.net:27017/events", {
          method: "POST",
          headers: {
            "Accept": "application/json",
            "Content-type": "application/json",
          },
          body: JSON.stringify(data),
        })
        console.log(data);
const mongoose = require("mongoose");

mongoose.connect(
  "mongodb+srv://***:***@ffc.kv8qoen.mongodb.net/?retryWrites=true&w=majority",
  { useNewUrlParser: true, useUnifiedTopology: true },
  (err) => {
    if (!err) console.log("Mongodb connected");
    else console.log("Connection error :" + err);
  }
);

image

Thanks for your help

Hi @Baptiste_LOY - Welcome to the community.

The error and the POST format does appear quite odd but perhaps there is something i’m missing here.

However, can you advise the context for this question / error? Are you trying to perform some read / writes to your cluster via the API? If so, i’d recommend going over the Atlas Data API documentation.

Regards,
Jason

2 Likes