angular-firebase-stripe icon indicating copy to clipboard operation
angular-firebase-stripe copied to clipboard

Cannot read property 'secret' of undefined

Open r6047736 opened this issue 5 years ago • 3 comments

firebase deploy --only functions

=== Deploying to 'stripe-13ae7'...

i deploying functions Running command: npm --prefix "$RESOURCE_DIR" run build

functions@ build /Users/cesar/Desktop/reviewing Angular/stripe/stripeDemo/functions tslint -p tslint.json && ./node_modules/.bin/tsc

✔ functions: Finished running predeploy script. i functions: ensuring necessary APIs are enabled... ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

TypeError: Cannot read property 'secret' of undefined at Object. (/Users/cesar/Desktop/reviewing Angular/stripe/stripeDemo/functions/lib/app/config.js:36:46) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/Users/cesar/Desktop/reviewing Angular/stripe/stripeDemo/functions/lib/index.js:3:1) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18)

Does anyone know what's the problem here? I followed the video tutorial and it just doesn't work now. Can anyone give an advice?

r6047736 avatar Aug 11 '18 01:08 r6047736

Add your Stripe API keys to credentials.json

"stripe": {
    "publishable": "foo",
    "secret": "bar",
    "clientid": "baz"
}

reyco1 avatar Aug 15 '18 00:08 reyco1

was that because you were using Windows? I had the same problem but the videos suggested not to use stripe secret; instead I kept trying to use "firebase functions:config:set stripe.secret=bla bla bla"

mfeldman143 avatar Nov 30 '18 00:11 mfeldman143

I'm running into a similar problem when I run "firebase serve"

$ firebase serve

=== Serving from '/Users/Mitt/Dev/fireship/stripe'...

✔  functions: Using node@8 from host.
i  hosting: Serving hosting files from: public
✔  hosting: Local server: http://localhost:5000
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/Users/Mitt/Dev/fireship/stripe/functions" for Cloud Functions...
⚠  TypeError: Cannot read property 'secret' of undefined
    at Object.<anonymous> (/Users/Mitt/Dev/fireship/stripe/functions/lib/config.js:12:49)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/Mitt/Dev/fireship/stripe/functions/lib/sources.js:13:18)
    at Module._compile (module.js:653:30)
⚠  We were unable to load your functions code. (see above)
   - It appears your code is written in Typescript, which must be compiled before emulation.
   - You may be able to run "npm run build" in your functions directory to resolve this.

I've tried "npm run build", but it hasn't fixed it.

I'm still struggling to understand where this error is coming from so I know how to dig into fixing it.

mittcoats avatar Jul 21 '19 00:07 mittcoats