skip to Main Content

I am using NodeJS and MongoDB atlas to create my own API for my online portfolio. I have tested it locally and it’s working fine. So I decided to deploy it and test it in ‘Render(Web Services)’ because it is free.

I deployed it and the build was successful.
actual log

However, I got this error log after:
actual error log

Error log:

/opt/render/project/src/node_modules/mongodb/lib/operations/find_and_modify.js:33
Aug 30 01:46:27 PM options.includeResultMetadata ??= false;

I have tried searching for an answer, but I can’t seem to find one. But I am still working on it because I badly need this for my online portfolio.

I don’t know how to fix this. Please help! Any idea? :<

2

Answers


  1. maybe you’ve solved it by now but i had the same issue and it turns out that i was using a NodeJS version that did not support the ‘??=’ operator.

    As you can see in the table almost at the bottom on this page the support for the ‘??=’ operator was added in NodeJS 15.0.0. Apparently on your development machine you are running a newer NodeJS version, and on your production machine you are running an older NodeJS version.

    Upgrading the NodeJS version on your production machine should solve this error 🙂

    Login or Signup to reply.
  2. Add the engines in package.json

    {
    "dependencies": {
    "bcryptjs": "^2.4.3",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "jsonwebtoken": "^9.0.2",
    "mongodb": "^6.1.0",
    "nodemon": "^3.0.1"
    },
    "engines": {

    "node": ">=14 <18.17.1"
    

    }

    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search