'TypeError: Cannot read property 'secret' of undefined
I am fairly new to this, I am using node.js to integrate stripe with a firebase ios project I am working on. I haven't seen an answer on how to solve this, here is relevant code in my lib/index.js:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const functions = require("firebase-functions");
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
// export const helloWorld = functions.https.onRequest((request, response) => {
// functions.logger.info("Hello logs!", {structuredData: true});
// response.send("Hello from Firebase!");
// });
'use strict';
const admin = require('firebase-admin');
admin.initializeApp();
const { Logging } = require('@google-cloud/logging');
const logging = new Logging({
projectId: process.env.GCLOUD_PROJECT,
});
const stripe = require('stripe')(functions.config().stripe.secret, {
apiVersion: '2020-03-02',
});
Solution 1:[1]
Set up functions configuration If you're using custom functions configuration variables, first run the command to get your custom config (run this within the functions directory) in your local environment: firebase functions:config:get > .runtimeconfig.json https://firebase.google.com/docs/functions/local-emulator
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Priya Sharma |
