error Error: could not handle the request

import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'

admin.initializeApp()

export const helloWorld = functions.https.onRequest((request, response) => {
    response.send("")
})

export const clientRequest = functions.https.onRequest((request, response) => {

    //if (["POST", "OPTIONS"].indexOf(request.method.toUpperCase()) === -1) response.send('wrong request type')

    const store = admin.firestore()

    const sendData = {
        clientName: 'qwe!'
    };

    store
        .collection('items')
        .add(sendData)
        .then(success => {
            response.send("");
        }).catch(error => {
            response.send(error)
        })
})

Why? Yesterday that work!

i functions: packaged functions (46.51 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating function helloWorld...
i functions: updating function clientRequest...
+ functions[clientRequest]: Successful update operation.
+ functions[helloWorld]: Successful update operation.
+ Deploy complete!

Upvotes: 0

Views: 1853

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83048

What happens if you change the end of your code to

    .then(success => {
        response.status(200).send("");
    }).catch(error => {
        response.status(500).send(error)
    })

Upvotes: 1

Related Questions