Closed soundstep closed 2 days ago
@soundstep Can you try add a RUN deno cache main.ts
right after the # Warmup caches
comment? It is possible that warming up this script (with downloading of dependencies), takes more than 10 seconds.
We can adjust that in the guide if that is the case.
@lucacasonato
This gave me the exact same error:
# Warmup caches
RUN timeout 10s deno run -A main.ts || [ $? -eq 124 ] || exit 1
RUN deno cache main.ts
This seem to have fixed it:
# Warmup caches
ENV DENO_DIR=$HOME/.cache/deno
RUN timeout 10s deno run -A main.ts || [ $? -eq 124 ] || exit 1
RUN deno cache main.ts
I guess deno just couldn't write in /home/sbx_user1051/.cache/deno
.
Does that fix make sense?
Side question: Does RUN deno cache main.ts
work because it runs for the first time? It doesn't do anything locally unless I do deno cache -r main.ts
.
Ah yes, that makes sense. DENO_DIR is computed relative to the user's home directory. If the build user and the runtime user are different, the DENO DIR will be different. I am updating the docs to recommend specifying a DENO_DIR explicitly: https://github.com/denoland/docs/pull/850.
deno cache ...
does not look like it does anything after the first time, because the files will already be cached. It only prints out new files it is downloading. deno cache -r
forcibly re-downloads all files, so that is why you are seeing output for that.
Great, thanks for the additional info!
@lucacasonato FYI, side note: https://github.com/maxday/lambda-perf/pull/1492
Version: Deno 1.45.2
I'm applying this guide: https://docs.deno.com/runtime/tutorials/aws_lambda/
I've got some permissions issue in the container. I can see what kind of problem this is, but what would be an elegant way of solving? A chmod? Using DENO_DIR?
The AWS Lambda log:
Dockerfile: