Git Product home page Git Product logo

elastic-cloud's People

Contributors

kickbykick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elastic-cloud's Issues

Getting error in update cloud function, but create and delete function working fine.

ResponseError: x_content_parse_exception at onBody (/workspace/node_modules/@elastic/elasticsearch/lib/Transport.js:311:23) at IncomingMessage.onEnd (/workspace/node_modules/@elastic/elasticsearch/lib/Transport.js:240:11) at IncomingMessage.emit (events.js:327:22) at IncomingMessage.EventEmitter.emit (domain.js:506:15) at endReadableNT (_stream_readable.js:1220:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) updatePost

ResponseError: illegal_argument_exception

hi @Kickbykick
i got this error in functions console logs
ResponseError: illegal_argument_exception
at IncomingMessage.response.on (/workspace/node_modules/@elastic/elasticsearch/lib/Transport.js:257:25)
at IncomingMessage.emit (events.js:203:15)
at IncomingMessage.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

and my code is

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const { Client } = require('@elastic/elasticsearch')

admin.initializeApp(functions.config().firebase);

const env = functions.config();
const auth = {
  username: env.elasticsearch.username,
  password: env.elasticsearch.password,
};

const client = new Client({
    node: env.elasticsearch.url,
    auth: auth,
})


exports.createPost = functions.firestore
    .document('chores/{choreId}')
    .onCreate( async (snap, context) => {

      console.log(snap.data());
        await client.index({
            index: 'chores',
            type: '_doc',
            id: snap.id,
            body: snap.data()
        })
    });

exports.updatePost = functions.firestore
    .document('chores/{choreId}')
    .onUpdate( async (snap, context) => {
        await client.update({
            index: 'chores',
            type: '_doc',
            id: context.params.choreId,
            body: snap.after.data()
        })
    });

exports.deletePost = functions.firestore
    .document('chores/{choreId}')
    .onDelete( snap => {
        client.delete({
            index: 'chores',
            type: '_doc',
            id: snap.id,
        })
    });

@Kickbykick ### please help me in resolvig this issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.