skip to Main Content

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


  1. Is it an issue with caching the imports?

    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

    https://raw.githubusercontent.com/denosaurs/denon/master/denon.ts
    

    You can also change your code dependencies:

    Change https://deno.land/x/oak/mod.ts with https://raw.githubusercontent.com/oakserver/oak/master/mod.ts

    and for redis you should use https://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.

    deno.land/x is a URL rewriting service for Deno scripts. The basic
    format of code URLs is
    https://deno.land/x/MODULE_NAME@BRANCH/SCRIPT.ts. If you leave out the
    branch, it will default to the module’s default branch, usually
    master.


    You should use tagged releases instead of master otherwise your docker image won’t have always the same Oak code.

    For v4.0.0

    export { Application, Router } from 'https://github.com/oakserver/oak/blob/v4.0.0/mod.ts'
    export { connect } from 'https://raw.githubusercontent.com/keroxp/deno-redis/v0.10.1/mod.ts
    
    Login or Signup to reply.
  2. 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:

    import { opn } from 'https://denopkg.com/hashrock/deno-opn/opn.ts'
    
    opn('https://denopkg.com')
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search