aws / aws-lambda-nodejs-runtime-interface-client

Apache License 2.0
181 stars 56 forks source link

NPM Logs error when starting #56

Closed kailashyogeshwar85 closed 2 years ago

kailashyogeshwar85 commented 2 years ago

I have my image with below dockerfile

Dockerfile

# CREATE IMAGE EXTENDING BASE IMAGE FOR PDF CREATION
FROM pdfgenerator:latest
ARG FUNCTION_DIR='/function'
COPY src ${FUNCTION_DIR}/
WORKDIR ${FUNCTION_DIR}
RUN echo "npm installing silently"
RUN npm i --silent

When i test the function after updating function i get START RequestId: 35335333-e8f7-42f4-9116-18c76b985561 Version: $LATEST npm ERR! code EROFS npm ERR! syscall mkdir npm ERR! path /home/sbx_user1051 npm ERR! errno -30 npm2022-09-18T10:58:06.114Z undefined INFO Executing 'index.handler' in function directory '/function' ERR! rofs EROFS: read-only file system, mkdir '/home/sbx_user1051' npm ERR! rofs Often virtualized file systems, or other file systems npm ERR! rofs that don't support symlinks, give this error. npm ERR! Log files were not written due to an error writing to the directory: /home/sbx_user1051/.npm/_logs npm ERR! You can rerun the command with --loglevel=verbose to see the logs in your terminal END RequestId: 35335333-e8f7-42f4-9116-18c76b985561 REPORT RequestId: 35335333-e8f7-42f4-9116-18c76b985561 Duration: 561.31 ms Billed Duration: 562 ms Memory Size: 3072 MB Max Memory Used: 52 MB
RequestId: 35335333-e8f7-42f4-9116-18c76b985561 Error: Runtime exited with error: exit status 226 Runtime.ExitError

kailashyogeshwar85 commented 2 years ago

Solution

In your dockerfile just add below line ENV HOME="/tmp"

This will resolve the above issue