Skip to content

v7.10.0 does not build #1397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lulurian opened this issue Feb 4, 2021 · 3 comments
Closed

v7.10.0 does not build #1397

lulurian opened this issue Feb 4, 2021 · 3 comments

Comments

@lulurian
Copy link

lulurian commented Feb 4, 2021

💬 Questions and Help

Please note that this issue tracker is not a help forum and this issue may be closed.

Hello!
I have the same issue form this topic (#803) but nothing from there is helping me.
Im trying to import elasticsearch in my app.
I installed npm install @elastic/elasticsearch and npm i @types/node

node: v12.16.1
@elastic/elasticsearch: ^7.10.0
os: MacOS 10.15.6
typescript: ^3.7.2

When i try what @delvedor suggested #803 (comment)
my index is empty.

In the code i just imported:
import { Client } from '@elastic/elasticsearch';
and then const client = new Client({ node: 'http://localhost:9200' });

The error that i get when i try to run the app :
image

Thank you!

@delvedor
Copy link
Member

delvedor commented Feb 4, 2021

Hello! A few questions:

  • Are you using the client in the browser?
  • Are you using the code in Node.js and using webpack for creating a single bundle?

@lulurian
Copy link
Author

lulurian commented Feb 4, 2021

@delvedor
Yes, the client it's in the browser.
I have a React project with typescript and i'm trying to call the elasticsearch from it. I think we are using webpack, as far as i know the app was created with create-react-app.

Hope this answer your questions.
Thanks a lot!

@lulurian lulurian closed this as completed Feb 4, 2021
@lulurian lulurian reopened this Feb 4, 2021
@delvedor
Copy link
Member

delvedor commented Feb 4, 2021

This library is not meant to work from the browser, as you can see here.
I recommend writing a lightweight Node.js proxy to send requests to Elasticsearch and make your frontend talk with the proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants