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

spawn EACCES error #4

Open
carboni09 opened this issue Aug 22, 2018 · 8 comments
Open

spawn EACCES error #4

carboni09 opened this issue Aug 22, 2018 · 8 comments

Comments

@carboni09
Copy link

screenshot 14

Here's is the error I get when I deploy and run it.

"@google-cloud/storage": "^1.3.1",
"firebase-admin": "~5.4.0",
"firebase-functions": "^2.0.2",

exception: { Error: spawn EACCES at exports._errnoException (util.js:1020:11) at ChildProcess.spawn (internal/child_process.js:328:11) at exports.spawn (child_process.js:370:9) at Object.exec (/user_code/node_modules/gs/index.js:86:28) at /user_code/index.js:43:7 at bucket.file.download.then (/user_code/index.js:33:11) at process._tickDomainCallback (internal/process/next_tick.js:135:7) code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }

@prescottprue
Copy link

Looks like you are trying to download a file that isn't there. Make sure you use os.tmpdir() instead of just /tmp since you can't write to the base file system of cloud functions.

@samirlegdah
Copy link

Hi everyone, I also have the same problem of @carboni09 ... how can I solve it?

@prescottprue i use os.tmpdir()

@tpetrone
Copy link

tpetrone commented Apr 1, 2019

@samirlegdah do you have any modifications in the code presented in this repo?
@carboni09 have you been able to fix the problem?

@morfinismo
Copy link

Same thing happening right here. How can I fix this problem? I am using os.tmpdir() as suggested. Any help is greatly appreciated!

@RicardoElSabio
Copy link

Were you able to figure it out? I am facing the same issue, and i cant figure it out

@morfinismo
Copy link

I never figured it out. I ended up using a vm to get this to work. From cloud functions now I call the service on the vm that returns the image.

@prescottprue
Copy link

prescottprue commented Aug 10, 2019

I also switched to using a VM, but recently have been working with Cloud Run which supports Docker images. FWIW, here is the Dockerfile we are using:

FROM launcher.gcr.io/google/nodejs

# For A specific Ghostscript version (i.e 9.20)
# Install wget
RUN apt-get update -y && \
    apt-get install -y wget && \
    rm -rf rm /var/lib/apt/lists/*_*

## Get Ghostscript 9.20
RUN wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/ghostscript-9.20.tar.gz

## Unzip, build, and install Ghostscript
RUN tar xvf ghostscript-9.20.tar.gz
RUN ./ghostscript-9.20/configure
RUN make ./ghostscript-9.20
RUN make install ./ghostscript-9.20

# OR if you prefer using the latest, uncomment the following:
## Install latest ghostscript
# RUN apt-get update -y && \
#     apt-get -y install ghostscript && apt-get clean && \
#     rm -rf rm /var/lib/apt/lists/*_*

# Log Ghoscript verion
RUN gs -v

# Set directory to app
WORKDIR /usr/src/app

# Copy package and package lock file
COPY package*.json ./

# Copy code
COPY . ./

## Install Node.js 8.14.1
RUN install_node v8.14.1

ENV NODE_ENV development

## Install dependencies
RUN npm install
# or if you only want non-dev dependencies:
# RUN npm install --production

## Environment Variables
ENV NODE_ENV production

# Build server code (if using babel or similar)
RUN npm run build

CMD npm start

@glush
Copy link

glush commented May 13, 2020

Try to change executablePath to .executablePath('gs') as mentioned here: https://stackoverflow.com/questions/50816826/error-cloud-functions-for-firebase-spawn-eacces-ghostscript

It works for me.

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

7 participants