Cougs75
Cougs75

Reputation: 21

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',
});

Upvotes: 0

Views: 876

Answers (1)

Priya Sharma
Priya Sharma

Reputation: 11

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

Upvotes: 1

Related Questions