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.

UnhandledPromiseRejectionWarning Error

See original GitHub issue

Hello All,

I’m using Node 14 and seem to be running into this error when adding simple test data to solr:

const solr = require('solr-client');
const client = solr.createClient();

client.add({ id: 12, title_t: 'Hello' }, function(err, obj) {
       if (err) {
            console.log(err);
        } else {
            console.log('Solr response:', obj);
        }
}

(node:39116) UnhandledPromiseRejectionWarning: Error: Request HTTP error 404: at Client.doRequest (…/node_modules/solr-client/dist/lib/solr.js:141:19) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Use node --trace-warnings ... to show where the warning was created) (node:39116) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:39116) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Appreciate any help. Thank you

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

2reactions
kibertoadcommented, Oct 20, 2021

@ranrao Do you use Docker? This is how we init Solr Docker image:

services:
  solr:
    container_name: solr_dev
    image: solr:8.9.0
    ports:
      - "8983:8983"
    networks:
      - proxynet
    volumes:
      - data:/root/solr
      - /root/solr:/opt/solr-8.9.0/customSettings
    entrypoint:
      - bash
      - "-c"
      - "precreate-core testcore; precreate-core vehicles; precreate-core users /opt/solr-8.9.0/customSettings/users; precreate-core organizations; precreate-core classifiers; precreate-core departments; precreate-core roles; exec solr -f"
    hostname: solr_hostname

Alternatively see this: https://www.tutorialspoint.com/apache_solr/apache_solr_core.htm

1reaction
ranraocommented, Oct 20, 2021

Thank you @kibertoad. Tried creating a Solr core and it is all working very well now. Such timely help. Really appreciate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a UnhandledPromiseRejectionWarning when testing ...
The "Unhandled promise rejection" is also caused by the failed assertion, because if an error is thrown in a catch() handler, and there...
Read more >
What is UnhandledPromiseRejectionWarning
UnhandledPromiseRejectionWarning. The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
Read more >
Fixing UnhandledPromiseRejectionWarning in Node.js
There's a little problem though. It's very easy to forget to handle Promise rejections, and this can lead to hard-to-debug issues. If we...
Read more >
Unhandled Promise Rejections in Node.js - The Code Barbarian
What is an Unhandled Rejection? "Rejection" is the canonical term for a promise reporting an error. As defined in ES6, a promise is...
Read more >
Unhandled Promise Rejection Warning - Codecademy Forums
I keep getting this error when I run my code UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by ...
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