rust-lang/docs.rs

cargo docs build failing

Closed this issue · 3 comments

Crate name

dweb

Build failure link

https://docs.rs/crate/dweb/0.7.0/builds

Additional details

I only just noticed this and assume the reason is "Network access blocked. I see that it began failing when I added the following dependencies which I believe do include their own build script:

utoipa = { version = "5.3.1", features = ["actix_extras", "non_strict_integers"] }
utoipa-actix-web = "0.1.2"
utoipa-swagger-ui = { version = "9.0.0", features = ["reqwest", "actix-web"] }

And indeed, your build log points to this:

[INFO] [stderr]   thread 'main' panicked at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/utoipa-swagger-ui-9.0.1/build.rs:216:50:
[INFO] [stderr]   failed to download Swagger UI: reqwest::Error { kind: Request, url: "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.14.zip", source: hyper_util::client::legacy::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: Temporary failure in name resolution" })) }
[INFO] [stderr]   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, doing cargo docs locally - without network access - does succeed, which suggests it isn't trying to access the network (since that should fail according to the documentation for cargo docs). Also, utoipa itself does build docs on docs.rs (though they had a similar problem early on).

So I'm not sure if utoipa is the cause here and if so what to do about it?

Thanks.

Network access in builds is blocked and will never be allowed due to security reasons.

A good start for more details is always our https://docs.rs/about/builds page.

Generally people solve this issue by either

So I'm not sure if utoipa is the cause here and if so what to do about it?

It always looking at the docs.rs metadata for the dependency. In this case, utoipa-swagger-ui is activating a vendored feature.

https://github.com/juhaku/utoipa/blob/ac71b2353e144998f50bfe38d37794f39c151027/utoipa-swagger-ui/Cargo.toml#L46-L49

So the solution would be to set up your own docs.rs metadata in which you enable the vendored feature in utoipa-swagger-ui.

closing this issue, reasons in the comment above.

Feel free to comment / reopen if still not solved.

Thank you very much for pointing me in the right direction. Unfortunately I'm struggling to fix this having studied the resources and how utoipa-swagger-ui also handle it for their package. I've tried a few changes to my dweb-lib/Cargo.toml in each recent release but am not getting anywhere.

If someone could point out what's wrong / missing I'd appreciate it.