Code.fetch_docs in an Elixir release

I’m working on trying to pull the @moduledoc from a module with a __using__ macro, to print the documentation to the screen. I’m using Code.fetch_docs/1 which works beautifully when running an iex session.

The problem is when I build a release though - I get {:error, :chunk_not_found} when calling Code.fetch_docs.

The code to fetch docs is in a separate dependency and this is where I’m using it genex

I’m sure I’m missing something simple - or misunderstanding how Code.fetch_docs/1 works.

Any ideas what may be happening here?

Documentation gets stripped from the release by default.

1 Like

Thanks @mudasobwa - I went back and read the documentation for releases and found the :strip_beams option to be the solve:

releases: [
        genex: [
          steps: [:assemble, &Bakeware.assemble/1],
          strip_beams: [keep: ["Docs"]]
        ]
      ]
5 Likes

https://hexdocs.pm/elixir/Code.html#compiler_options/0

docs: true option seems to be your friend as well to try to do it on per-file basis, but I neved had tried it.

2 Likes