Skip to content

Conversation

samtstern
Copy link
Contributor

@samtstern samtstern commented Dec 28, 2020

Description

Fix #2966

Scenarios Tested

✅ Unit tests added
✅ Manual testing

functions/index.js

const functions = require('firebase-functions');

const helloWorld = functions.https.onRequest((request, response) => {
  response.send("Hello from Firebase!");
});

exports.functions = {
  helloWorld
};

Start emulators

$ firebase emulators:start
i  emulators: Starting emulators: functions
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub
⚠  Your requested "node" version "12" doesn't match your global version "10"
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/private/var/folders/xl/6lkrzp7j07581mw8_4dlt3b000643s/T/tmp.4l0amrGc/functions" for Cloud Functions...
✔  functions[functions-helloWorld]: http function initialized (http://localhost:5001/fir-dumpster/us-central1/functions-helloWorld).

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://localhost:4000                │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ localhost:5001 │ http://localhost:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: 4500

200 Request

$ http http://localhost:5001/fir-dumpster/us-central1/functions-helloWorld
HTTP/1.1 200 OK
connection: keep-alive
content-length: 20
content-type: text/html; charset=utf-8
date: Mon, 28 Dec 2020 15:50:38 GMT
etag: W/"14-z3iZXchEt5DVWZKsMncy8Wl4KSQ"
x-powered-by: Express

Hello from Firebase!

400 Request:

$ http http://localhost:5001/fir-dumpster/us-central1/functions.helloWorld
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 86
Content-Type: text/html; charset=utf-8
Date: Mon, 28 Dec 2020 15:50:58 GMT
ETag: W/"56-o2lBSK2ZagofGuWRTO91r8ShW5M"
X-Powered-By: Express

Function functions.helloWorld does not exist, valid triggers are: functions-helloWorld

Sample Commands

@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Dec 28, 2020
@samtstern samtstern merged commit c3b8c22 into master Dec 30, 2020
@bkendall bkendall deleted the ss-fix-2966 branch August 4, 2021 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase Emulator initialization URL given for module grouped firebase functions hangs and requires modification to work.
2 participants