Skip to content
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

Fix functions config proxy #2302

Merged
merged 1 commit into from
May 28, 2020
Merged

Fix functions config proxy #2302

merged 1 commit into from
May 28, 2020

Conversation

samtstern
Copy link
Contributor

Description

Fixes #2301

Caused by this line:

ff.config = () => proxiedConfig;

Likely to do with today's 3.6.2 release of firebase-functions but unclear. The underlying error is a strict-mode violation.

Scenarios Tested

logs

$ firebase emulators:start --only functions
i  emulators: Starting emulators: functions
⚠  Your requested "node" version "8" 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.zlMaGwgR/functions" for Cloud Functions...
⚠  It looks like you're trying to access functions.config().firebase but there is no value there. You can learn more about setting up config here: https://firebase.google.com/docs/functions/local-emulator
✔  functions[checkConfig]: http function initialized (http:https://localhost:5001/fir-dumpster/us-central1/checkConfig).

┌───────────────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! View status and logs at http:https://localhost:4000 │
└───────────────────────────────────────────────────────────────────────┘

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

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
i  functions: Beginning execution of "checkConfig"
>  config { foo: 'bar' }
i  functions: Finished "checkConfig" in ~1s

functions/index.js

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.checkConfig = functions.https.onRequest(async (request, response) => {
  console.log("config", functions.config());
  response.send("Hello from Firebase!");
});

functions/runtimeconfig.json

{
  "foo": "bar"
}

functions/package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "8"
  },
  "dependencies": {
    "firebase-admin": "^8.10.0",
    "firebase-functions": "^3.6.2"
  },
  "devDependencies": {
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

Sample Commands

N/A

@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label May 28, 2020
@samtstern samtstern merged commit a121f6d into master May 28, 2020
samtstern added a commit that referenced this pull request May 28, 2020
@samtstern samtstern mentioned this pull request May 28, 2020
samtstern added a commit that referenced this pull request May 28, 2020
@bkendall bkendall deleted the ss-fix-2301 branch August 4, 2021 19:25
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.

Cannot set property config of #<Object> which has only a getter
4 participants