Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

mongodb - TypeError: Cannot read property 'match' of undefined

I've deployed a next.js app in AWS Amplify and while it works fine on my local machine I'm getting this error when I try to access any of the /api/ route:

ERROR   Unhandled Promise Rejection     {
        "errorType": "Runtime.UnhandledPromiseRejection",
        "errorMessage": "TypeError: Cannot read property 'match' of undefined",
        "reason": {
            "errorType": "TypeError",
            "errorMessage": "Cannot read property 'match' of undefined",
            "stack": [
                "TypeError: Cannot read property 'match' of undefined",
                "    at new ConnectionString (/var/task/chunks/925.js:11169:27)",
                "    at parseOptions (/var/task/chunks/925.js:21799:17)",
                "    at new MongoClient (/var/task/chunks/925.js:26423:63)",
                "    at connectToDatabase (/var/task/chunks/817.js:30:18)",
                "    at handler (/var/task/pages/api/assets.js:191:97)",
                "    at Object.apiResolver (/var/task/chunks/925.js:36862:15)",
                "    at processTicksAndRejections (internal/process/task_queues.js:95:5)",
                "    at async Module.<anonymous> (/var/task/chunks/925.js:34836:13)"
            ]
        },
        "promise": {},
        "stack": [
            "Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'match' of undefined",
            "    at process.<anonymous> (/var/runtime/index.js:35:15)",
            "    at process.emit (events.js:400:28)",
            "    at processPromiseRejections (internal/process/promises.js:245:33)",
            "    at processTicksAndRejections (internal/process/task_queues.js:96:32)"
        ]
    }

 

I'm sure it has something to with mongodb since the error is happening in MongoClient but I'm not sure what exactly the problem is. Please help.

 

-----------------------

code from AWS project ideas.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Off-topic

Don't F&*% the planet.

Over the weekend, Atlassian ran a New York Times ad calling on business leaders to join us in committing to a net zero future through the Science-Based Targets Initiative. As part of our gl...

324 views 0 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you