zhaofengli / attic

Multi-tenant Nix Binary Cache

Home Page:https://docs.attic.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

S3 backend at idrive.com giving me internal server error

mannp opened this issue · comments

Using the flake on a server with a postgresql db and s3 backend, behind nginx.

Had an issue with nginx uploads but resolved that, so atticd seems to get as far as uploading to itself and then fails tying to offload that to my s3 provider.

Any ideas as to what I might have done wrong would be great, :) thanks in advance.

Tried with AWS credentials and;

credentials = {
          access_key_id = config.sops.secrets."attic-server/access-key-id".path;
          secret_access_key = config.sops.secrets."attic-server/secret-access-key".path;
        };

Clent error;

❌ nw1drydykfs0gwxyz06ksj2z1pszi0br-attic-0.1.0: InternalServerError: The server encountered an internal error or misconfiguration.
Error: InternalServerError: The server encountered an internal error or misconfiguration.

Server error;

Feb 03 19:23:27 mini atticd[20804]: Listening on 127.0.0.1:8083...
Feb 03 19:30:32 mini atticd[20804]: 2024-02-03T19:30:32.310145Z ERROR attic_server::error: Storage error: Storage error: dispatch failure
Feb 03 19:30:32 mini atticd[20804]:    0: tokio::task::runtime.spawn
Feb 03 19:30:32 mini atticd[20804]:            with kind=task task.name= task.id=22 loc.file="server/src/api/v1/upload_path.rs" loc.line=408 loc.col=13
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tokio-1.34.0/src/util/trace.rs:17
Feb 03 19:30:32 mini atticd[20804]:    1: attic_server::api::v1::upload_path::upload_path
Feb 03 19:30:32 mini atticd[20804]:              at server/src/api/v1/upload_path.rs:117
Feb 03 19:30:32 mini atticd[20804]:    2: tower_http::trace::make_span::request
Feb 03 19:30:32 mini atticd[20804]:            with method=PUT uri=/_api/v1/upload-path version=HTTP/1.1
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tower-http-0.4.4/src/trace/make_span.rs:109
Feb 03 19:30:32 mini atticd[20804]:    3: tokio::task::runtime.spawn
Feb 03 19:30:32 mini atticd[20804]:            with kind=task task.name= task.id=18 loc.file="/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/hyper-0.14.27/src/com>
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tokio-1.34.0/src/util/trace.rs:17
Feb 03 19:30:32 mini atticd[20804]:    0: tokio::task::runtime.spawn
Feb 03 19:30:32 mini atticd[20804]:            with kind=task task.name= task.id=22 loc.file="server/src/api/v1/upload_path.rs" loc.line=408 loc.col=13
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tokio-1.34.0/src/util/trace.rs:17
Feb 03 19:30:32 mini atticd[20804]:    1: attic_server::api::v1::upload_path::upload_path
Feb 03 19:30:32 mini atticd[20804]:              at server/src/api/v1/upload_path.rs:117
Feb 03 19:30:32 mini atticd[20804]:    2: tower_http::trace::make_span::request
Feb 03 19:30:32 mini atticd[20804]:            with method=PUT uri=/_api/v1/upload-path version=HTTP/1.1
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tower-http-0.4.4/src/trace/make_span.rs:109
Feb 03 19:30:32 mini atticd[20804]:    3: tokio::task::runtime.spawn
Feb 03 19:30:32 mini atticd[20804]:            with kind=task task.name= task.id=18 loc.file="/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/hyper-0.14.27/src/com>
Feb 03 19:30:32 mini atticd[20804]:              at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/tokio-1.34.0/src/util/trace.rs:17
Feb 03 19:30:32 mini atticd[20804]: 2024-02-03T19:30:32.310328Z ERROR tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=19564 ms
lines 266-312/312 (END)

Hi @mannp, I just had the same error and found your issue here.
I resolved it by adding the right bucket-name to my config in the storage section. Maybe you also overlooked this property, like I did?

    settings = {
      storage = {
        type = "s3";
        region = "us-east-1";
        bucket = "<bucketname>";
        endpoint = "<just endpoint name not url>";
        credentials = {
          access_key_id = config.sops.secrets."attic-server/access-key-id".path;
          secret_access_key = config.sops.secrets."attic-server/secret-access-key".path;
        };
.....

Hi @sn0cr, above is a snippet of my config, and don't believe I missed the bucket name. I just noted that maybe the endpoint needs to a url rather than just the endpoint domain name?

Did you use credentials like above or add the keyid and secret to the env files?

Thanks, though, I thought I was the only sufferer :)

So, I was also bitten by this issue and landed here.

My problem was that when credentials were set in storage.credentials (like in @mannp 's example config above), they were not getting read. Setting them as envvars seems to work fine.

For anyone wondering, the envvars are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

This is resolved for me now, thanks, key factors;

  1. Endpoint is https://endpoint with no trailing slash.
  2. envvars work now, with a correctly specified endpoint URL.

The use of credentials is for another day :)