This repository was archived by the owner on Nov 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ function isAppEngine() {
5252}
5353
5454function isCloudFunction ( ) {
55- return ! ! process . env . FUNCTION_NAME ;
55+ return ! ! ( process . env . FUNCTION_NAME || process . env . FUNCTION_TARGET ) ;
5656}
5757
5858async function isKubernetesEngine ( ) {
Original file line number Diff line number Diff line change @@ -1226,13 +1226,20 @@ describe('googleauth', () => {
12261226 scope . done ( ) ;
12271227 } ) ;
12281228
1229- it ( 'should get the current environment if GCF' , async ( ) => {
1229+ it ( 'should get the current environment if GCF 8 and below ' , async ( ) => {
12301230 envDetect . clear ( ) ;
12311231 mockEnvVar ( 'FUNCTION_NAME' , 'DOGGY' ) ;
12321232 const env = await auth . getEnv ( ) ;
12331233 assert . strictEqual ( env , envDetect . GCPEnv . CLOUD_FUNCTIONS ) ;
12341234 } ) ;
12351235
1236+ it ( 'should get the current environment if GCF 10 and up' , async ( ) => {
1237+ envDetect . clear ( ) ;
1238+ mockEnvVar ( 'FUNCTION_TARGET' , 'KITTY' ) ;
1239+ const env = await auth . getEnv ( ) ;
1240+ assert . strictEqual ( env , envDetect . GCPEnv . CLOUD_FUNCTIONS ) ;
1241+ } ) ;
1242+
12361243 it ( 'should get the current environment if GAE' , async ( ) => {
12371244 envDetect . clear ( ) ;
12381245 mockEnvVar ( 'GAE_SERVICE' , 'KITTY' ) ;
You can’t perform that action at this time.
0 commit comments