Skip to content

Commit

Permalink
fix(setup-timeout): ignore setup timeout for Cloud Functions by default
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Feb 18, 2020
1 parent 9de2e80 commit 5edc1fb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
@@ -120,12 +120,18 @@ const promise = new Promise((resolve, reject) => {
return promise
}

// timeout to handle setup
setTimeout(() => {
if (!client) {
reject(new Error('You must setup E-Com Plus auth before use SDK'))
}
}, 4000)
if (
process.env.ECOM_AUTH_SETUP_TIMEOUT !== 'disabled' &&
// ignore setup timeout for Google (Firebase) Cloud Functions by default
(!process.env.GCLOUD_PROJECT || process.env.ECOM_AUTH_SETUP_TIMEOUT === 'enabled')
) {
// timeout to handle setup
setTimeout(() => {
if (!client) {
reject(new Error('You must setup E-Com Plus auth before use SDK'))
}
}, 4000)
}
})

if (envDbFilename) {

0 comments on commit 5edc1fb

Please sign in to comment.