Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

"logs" location is not writable if node.js is installed via a package manager #210

Closed
fstanis opened this issue Jun 1, 2018 · 0 comments

Comments

@fstanis
Copy link
Contributor

fstanis commented Jun 1, 2018

(related to #195)

It seems that cloud-function-emulator tries to write logs to a location relative to where it's installed.

If node.js is installed using APT, then npm -g install firebase-tools must be run as root and will install cloud-functions-emulator to /usr/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator which is not writable by normal users.

Since the "logs" path is relative to this directory, mkdirSync will just fail on this line with EACCES: permission denied:

https://github.com/GoogleCloudPlatform/cloud-functions-emulator/blob/6dbd88345f6f7d129644d2547d949aaf36897fd0/src/emulator/logs.js#L65

Environment details

  • OS: Debian GNU/Linux buster/sid
  • Node.js version: v8.11.0
  • npm version: 6.1.0
  • @google-cloud/functions-emulator version: 1.0.0-beta.4

Steps to reproduce

  1. sudo apt-get install -y nodejs
  2. npm -g install firebase-tools
  3. firebase serve anywhere results in Error: An unexpected error has occurred. because of the EACCES exception thrown by cloud-function-emulator

A simple fix is just creating the logs folder manually, but would be great if it used a different folder by default:

sudo mkdir /usr/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/logs
sudo chmod 666 /usr/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/logs
@fstanis fstanis mentioned this issue Jun 9, 2018
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant