I am using deno with docker hayd/alpine-deno
image and denon
watching for file changes. When I build the container I get 429 Too Many Requests
importing the std
dependencies:
...
Download https://deno.land/[email protected]/encoding/_yaml/type/int.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/map.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/merge.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/nil.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/omap.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/pairs.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/seq.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/set.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/str.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/binary.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/bool.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/float.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/int.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/map.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/merge.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/nil.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/omap.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/pairs.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/seq.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/set.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/str.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts
error: Import 'https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts' failed: 429 Too Many Requests
My external dependencies are in deps.ts
which has the following imports:
export { Application, Router } from 'https://deno.land/x/oak/mod.ts'
export { connect } from 'https://deno.land/x/redis/mod.ts'
There are no other external dependencies apart from the ones denon imports.
Dockerfile I use to run it:
FROM hayd/alpine-deno:1.0.1
ENV DENO_DIR /cache
EXPOSE 4000
WORKDIR /app/
COPY . .
RUN deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
RUN deno cache src/deps.ts
ENTRYPOINT ["/root/.deno/bin/denon"]
CMD ["run", "--allow-net", "src/mod.ts"]
It appears many of the files are downloaded (or attempted to download, failed and retried) multiple times. This doesn’t always happen, but often enough to break build automation. Has anyone had a similar issue? Is it an issue with caching the imports?
2
Answers
No, caching has nothing to do with it.
It seems
deno.land
has rate limiting, and you’re exceeding those limits. What you can do is use github directly which most likely will have much higher limits.For Denon use
You can also change your code dependencies:
Change
https://deno.land/x/oak/mod.ts
withhttps://raw.githubusercontent.com/oakserver/oak/master/mod.ts
and for
redis
you should usehttps://raw.githubusercontent.com/keroxp/deno-redis/master/mod.ts
https://deno.land/x is nothing else but a URL rewriting server, so in the end, you’re actually pulling from Github.
You should use tagged releases instead of
master
otherwise your docker image won’t have always the same Oak code.For
v4.0.0
Deno package manager, pretty new. I check, Deno team still working on optimization.
Use pika, better support.
https://www.pika.dev/docs/
OR:
https://denopkg.com/
denopkg sample: