1

When I try to package a service using:

SLS_DEBUG=* $(npm bin)/serverless package

serverless-framework give me an error:

 Error -------------------------------------------------- EISDIR: illegal operation on a directory, read For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable. Stack Trace -------------------------------------------- Error: EISDIR: illegal operation on a directory, read at Object.fs.readSync (fs.js:675:18) at tryReadSync (fs.js:540:20) at Object.fs.readFileSync (fs.js:583:19) at GoogleProvider.getAuthClient (/Users/ldu020/workspace/serverless-functions/node_modules/serverless-google-cloudfunctions/provider/googleProvider.js:72:31) at GoogleProvider.request (/Users/ldu020/workspace/serverless-functions/node_modules/serverless-google-cloudfunctions/provider/googleProvider.js:43:29) at GooglePackage.setDeploymentBucketName (/Users/ldu020/workspace/serverless-functions/node_modules/serverless-google-cloudfunctions/shared/setDeploymentBucketName.js:22:26) From previous event: at Object.package:initialize [as hook] (/Users/ldu020/workspace/serverless-functions/node_modules/serverless-google-cloudfunctions/package/googlePackage.js:44:10) at BbPromise.reduce (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/lib/classes/PluginManager.js:390:55) From previous event: at PluginManager.invoke (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/lib/classes/PluginManager.js:390:22) at PluginManager.run (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/lib/classes/PluginManager.js:421:17) at variables.populateService.then.then (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/lib/Serverless.js:157:33) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) From previous event: at Serverless.run (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/lib/Serverless.js:144:8) at serverless.init.then (/Users/ldu020/workspace/serverless-functions/node_modules/serverless/bin/serverless:43:50) at <anonymous> 

How can I solve this? Thanks.

1 Answer 1

1

After take a look about the error stack. The reason of this issue is I did not set the environment variables for google credentials.

After that, it works.

☁ serverless-functions [pre-dev] ⚡ PROJECT_ID=pg-gx-e-app-700452 CREDENTIALS=/Users/ldu020/workspace/serverless-functions/.gcp/pg-gx-e-app-700452-98b46018b4ea.json $(npm bin)/sls package Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Compiling function "createCampaign"... Serverless: Compiling function "retrieveCampaignResult"... Serverless: Compiling function "updateCampaign"... Serverless: Compiling function "uploadMedia"... Serverless: Compiling function "createGGAWCampaign"... Serverless: Compiling function "updateGGAWCampaign"... Serverless: Compiling function "getSpecificGGAWCampaignInsightReport"... Serverless: Compiling function "createGGAWAdGroup"... Serverless: Compiling function "createGGAWExpandedTextAd"... 
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. In one of my environments, the environment variable GOOGLE_APPLICATION_CREDENTIALS was set to the directory instead of the full path of the file. Took me forever to notice.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.