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.

firebase deploy return an empty object {}

See original GitHub issue

[REQUIRED] Environment info

“firebase-admin”: “^8.10.0”,

“firebase-functions”: “^3.6.1”

firebase tools: 8.4.2 node version: v12.16.3

Windows 10 OS VS code

Platform:

[REQUIRED] Test case

As i am an absolute newbie in programming and development, i ahve followed the firebase youtube channel to try to use firebase cloud functions. So on the second video i ahve created the function in TS. Convereted it into JS. Deployed it and it works fine i.e. i can see the data from doc. So the next step was to use “firebase serve” instead of deploy. I have followed everything, but whne i use curl with the localhost link or even jsut a pure link, the output is an empty object {}.

[REQUIRED] Steps to reproduce

This is my code:

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


admin.initializeApp()


 export const getTask = functions.https.onRequest((request, response) => {
   admin.firestore()
   .collection('Rooms')
   .doc('RRN')
   .collection('Alpha')
   .doc('Task1')
   .get()
   .then(snapshot => {
      const data = snapshot.data()
      response.send(data)
  })
  .catch(error => {
      //Handle erroor
      console.log(error);
      response.status(500).send(error)
  })
 });

[REQUIRED] Expected behavior

Expected to return the data from the doc.

[REQUIRED] Actual behavior

instead, i jsut get this: {}

Any help guyz???

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
samtsterncommented, Jun 18, 2020

Very glad it worked, thanks for your patience!

1reaction
dvijeniii05commented, Jun 18, 2020

Hi @samtstern . I have fixed the issue with python not found.

After i have run your suggested command, i run firebase serve, then curl given-link and now i receive the right object back

$ curl http://localhost:5000/super-couples/us-central1/maybeTask
{"taskText":"First Task"}

Thanks a lot for your help guyz @samtstern @joehan Appreciate it a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase cloudfunction functions.config() returns an empty ...
I'm trying to access the token stored in functions.config().fb.token but functions.config() returns an empty object. To create the token I've ...
Read more >
Get started: write, test, and deploy your first functions - Firebase
When you initialize Firebase SDK for Cloud Functions, you create an empty project containing dependencies and some minimal sample code, and you choose ......
Read more >
Troubleshooting | Cloud Storage
Run gcloud storage ls --recursive gs://www.example.com/dir/ . If the output includes http://www.example.com/dir/ , you have an empty object at that location.
Read more >
Special Checks | Mendix Documentation
2 Checking for an Empty Object. Checks if an object is empty. ... Returns whether the object is empty, Boolean ...
Read more >
Empty - Firebase Hosting | AnyAPI Documentation
For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }. The JSON representation for Empty is empty JSON object {} .
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