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.

ERROR Error: Uncaught (in promise): ReferenceError: process is not defined

See original GitHub issue

Using Angular 6.0.2 and other up-to-date packages (s. package.json).

Migration from Elasticsearch 14.2.2 to 15.0.0 raised following error:

ERROR Error: Uncaught (in promise): ReferenceError: process is not defined
ReferenceError: process is not defined
    at Log.push../node_modules/elasticsearch/src/lib/log.js.Log.addOutput (log.js:213)
    at new Log (log.js:51)
    at new Transport (transport.js:19)
    at new EsApiClient (client.js:58)
    at new Client (client.js:101)
    at ElasticsearchService.push../src/app/services/elasticsearch.service.ts.ElasticsearchService.connect (elasticsearch.service.ts:33)
    at new ElasticsearchService (elasticsearch.service.ts:28)
    at _createClass (core.js:9260)
    at _createProviderInstance$1 (core.js:9234)
    at resolveNgModuleDep (core.js:9200)
    at Log.push../node_modules/elasticsearch/src/lib/log.js.Log.addOutput (log.js:213)
    at new Log (log.js:51)
    at new Transport (transport.js:19)
    at new EsApiClient (client.js:58)
    at new Client (client.js:101)
    at ElasticsearchService.push../src/app/services/elasticsearch.service.ts.ElasticsearchService.connect (elasticsearch.service.ts:33)
    at new ElasticsearchService (elasticsearch.service.ts:28)
    at _createClass (core.js:9260)
    at _createProviderInstance$1 (core.js:9234)
    at resolveNgModuleDep (core.js:9200)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4053)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)

My elasticsearch.service.ts looks like:

import { Injectable } from '@angular/core';
import { Client } from 'elasticsearch';

@Injectable()
export class ElasticsearchService {

  private client: Client;

  queryalldocs = {
    'query': {
      'match_all': {}
    }
  };

  constructor() {
    if (!this.client) {
      this.connect();
    }
  }

  private connect() {
    this.client = new Client({
      host: 'http://company.com:9200',
      log: 'trace'
    });
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
holgerzercommented, May 22, 2018

@spalger Thank you a LOT! I works with elasticsearch-browser!

0reactions
AlanObjectcommented, Jun 16, 2019

@delvedor I have an Angular application that currently uses a Java Web Service for a back end – I was thinking of converting it to an elasticsearch back end. Is this not possible without the security risk you mentioned? I was planning to use the Pack based authentication and access control. Is that not viable?

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Uncaught ReferenceError: process is not defined
My script is very simple, I am just trying to use a basic function of node.js, so I cannot figure out what errors...
Read more >
ReferenceError: “process is not defined” - GIMTEC
In this case, process is not defined in the browser environment, hence the error. The solution is to remove the reference to process...
Read more >
process is not defined (NOT react-error-overlay ... - GitHub
Using the optional chaining operator with process ( process?.env ) throws a ReferenceError stating that process is not defined. I originally ...
Read more >
"Uncaught ReferenceError: process is not defined" and the ...
The Uncaught ReferenceError: process is not defined happens when when a non-existent (here: process) variable is referenced .
Read more >
Uncaught ReferenceError: process is not defined
The error Uncaught ReferenceError: process is not defined may happen when the code tries to get access to the process object that provides ......
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