Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't deploy functions. Error: ENOTEMPTY: directory not empty, rmdir... #549

Closed
slipgoat opened this issue Nov 28, 2017 · 3 comments
Closed
Assignees

Comments

@slipgoat
Copy link

Version info

3.15.3

Steps to reproduce

Precondition: PC has restarted.
Run command firebase deploy --only functions twice.

Expected behavior

Deploy cloud functions executed well every time.

Actual behavior

Functions deployed successfully first time, but second time I have an unexpected error (Error: ENOTEMPTY: directory not empty, rmdir...).
Debug logs for the second deploy try:

[debug] [2017-11-28T16:57:15.764Z] ----------------------------------------------------------------------
[debug] [2017-11-28T16:57:15.766Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy --only functions
[debug] [2017-11-28T16:57:15.766Z] CLI Version:   3.15.3
[debug] [2017-11-28T16:57:15.766Z] Platform:      win32
[debug] [2017-11-28T16:57:15.766Z] Node Version:  v8.9.1
[debug] [2017-11-28T16:57:15.766Z] Time:          Tue Nov 28 2017 19:57:15 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:15.766Z] ----------------------------------------------------------------------
[debug] 
[debug] [2017-11-28T16:57:15.775Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2017-11-28T16:57:15.775Z] > authorizing via signed-in user
[debug] [2017-11-28T16:57:15.776Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/find-guide-staging  
 Tue Nov 28 2017 19:57:15 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:16.564Z] <<< HTTP RESPONSE 200
[debug] [2017-11-28T16:57:16.565Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/find-guide-staging/tokens  
 Tue Nov 28 2017 19:57:16 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:17.235Z] <<< HTTP RESPONSE 200
[info] 
[info] === Deploying to 'find-guide-staging'...
[info] 
[info] i  deploying functions
[debug] [2017-11-28T16:57:18.776Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "@google-cloud/storage": "^1.5.0",
    "child-process-promise": "^2.2.1",
    "firebase-admin": "~5.4.2",
    "firebase-functions": "^0.7.1",
    "mkdirp": "^0.5.1",
    "mkdirp-promise": "^5.0.1"
  },
  "private": true
}
[info] i  functions: ensuring necessary APIs are enabled...
[info] i  runtimeconfig: ensuring necessary APIs are enabled...
[debug] [2017-11-28T16:57:18.782Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/find-guide-staging?view=CONSUMER_VIEW  
 Tue Nov 28 2017 19:57:18 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:18.782Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/find-guide-staging?view=CONSUMER_VIEW  
 Tue Nov 28 2017 19:57:18 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:19.900Z] <<< HTTP RESPONSE 200
[info] +  functions: all necessary APIs are enabled
[debug] [2017-11-28T16:57:19.920Z] <<< HTTP RESPONSE 200
[info] +  runtimeconfig: all necessary APIs are enabled
[debug] [2017-11-28T16:57:19.922Z] >>> HTTP REQUEST GET https://appengine.googleapis.com/v1/apps/find-guide-staging  
 Tue Nov 28 2017 19:57:19 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:19.922Z] >>> HTTP REQUEST GET https://apikeys.googleapis.com/v1/projects/find-guide-staging/apiKeys  
 Tue Nov 28 2017 19:57:19 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:57:20.848Z] <<< HTTP RESPONSE 200
[debug] [2017-11-28T16:57:20.988Z] <<< HTTP RESPONSE 200
[info] i  functions: preparing functions directory for uploading...
[debug] [2017-11-28T16:58:01.260Z] >>> HTTP REQUEST GET https://runtimeconfig.googleapis.com/v1beta1/projects/find-guide-staging/configs  
 Tue Nov 28 2017 19:58:01 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:58:02.220Z] <<< HTTP RESPONSE 200
[debug] [2017-11-28T16:58:15.160Z] Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\ALEKSE~1.VER\AppData\Local\Temp\fbfn_90688hIp1L5B0dyH\node_modules\firebase-admin\node_modules\lolex\test'
    at Object.fs.rmdirSync (fs.js:846:18)
    at rmkidsSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:356:25)
    at rmdirSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:304:9)
    at C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:342:5
    at Array.forEach (<anonymous>)
    at rmkidsSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:341:26)
    at rmdirSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:334:7)
    at rimrafSync (C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:304:9)
    at C:\Users\Aleksey.Vershkov\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rimraf\rimraf.js:342:5
[error] 
[error] Error: An unexpected error has occurred.
[info] i  functions: packaged functions (66.89 KB) for uploading
[debug] [2017-11-28T16:58:15.167Z] >>> HTTP REQUEST GET https://www.googleapis.com/storage/v1/b/staging.find-guide-staging.appspot.com  
 Tue Nov 28 2017 19:58:15 GMT+0300 (Russia TZ 2 Standard Time)
[debug] [2017-11-28T16:58:15.372Z] <<< HTTP RESPONSE 200
[debug] [2017-11-28T16:58:15.372Z] >>> HTTP REQUEST POST https://www.googleapis.com/upload/storage/v1/b/staging.find-guide-staging.appspot.com/o?uploadType=media&name=firebase-functions-source ReadStream {
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 65536,
     buffer: BufferList { head: [Object], tail: [Object], length: 1 },
     length: 65536,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: false,
     sync: false,
     needReadable: false,
     emittedReadable: true,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: { end: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  path: 'C:\\Users\\ALEKSE~1.VER\\AppData\\Local\\Temp\\firebase-functions-90680PLB3FAc0X8m.zip',
  fd: 5,
  flags: 'r',
  mode: 438,
  start: undefined,
  end: undefined,
  autoClose: true,
  pos: undefined,
  bytesRead: 65536 } 
 Tue Nov 28 2017 19:58:15 GMT+0300 (Russia TZ 2 Standard Time)

Command firebase deploy acts as same.
I tried clear temp folder before run deploy second time, but it didn't help.

@justinrosenthal
Copy link

@slipgoat This sounds like the first deploy may not have had a chance to clean up after itself... did the first deploy complete before you started the second (failing) deploy?

@slipgoat
Copy link
Author

@justinrosenthal Yes, I run second (failing) deploy after first one completed successfully.

@laurenzlong
Copy link
Contributor

@slipgoat It seems like this is due to a Windows issue where Windows Search or a virus scanner that is currently scanning the file prevents it from being deleted. (isaacs/rimraf#25 (comment) and isaacs/rimraf#25 (comment))

To unblock you, you can install this branch of firebase-tools:

npm install -g https://github.com/firebase/firebase-tools.git#ll-tmpdir

This doesn't prevent deploy from proceeding if the temp folder cannot be deleted (however, I cannot fix the fact that the folder doesn't get deleted. You may want to periodically empty the /tmp/ folder manually if you are doing a lot of functions deploys.

bkendall added a commit that referenced this issue Sep 1, 2020
* initial channel create

* export default

* Update hosting-channel-create.ts

* Update hosting-channel-create.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants