Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete_object method return 403 SignatureDoesNotMatch Error. #382

Closed
maojinhua opened this issue Apr 10, 2024 · 1 comment
Closed

delete_object method return 403 SignatureDoesNotMatch Error. #382

maojinhua opened this issue Apr 10, 2024 · 1 comment
Assignees
Labels

Comments

@maojinhua
Copy link

Describe the bug
I can use put_object method and get_object method successfully,but when I delete_object method return 403 SignatureDoesNotMatch Error.

error desicribe

thread 'uploader::tests::upload_file' panicked at src/uploader.rs:108:59:
called `Result::unwrap()` on an `Err` value: Http(403, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx0000000000000005782b9-0066164d99-57823ee-object-store-pool</RequestId><HostId>57823ee-object-store-pool-object-store-pool</HostId></Error>")
stack backtrace:

To Reproduce
test code like this

 #[tokio::test]
    async fn upload_file() {
        let region = Region::Custom {
            region: "".into(),
            endpoint: ENDPOINT.to_string(),
        };

        let credentials = Credentials::new(
            Some(&ACCESS_KEY.to_string()),
            Some(&SECRET_KEY.to_string()),
            None,
            None,
            None,
        )
        .unwrap();

        let mut bucket = Bucket::new(&BUCKET_NAME.to_string(), region, credentials)
            .unwrap()
            .with_path_style();

        let path = "test.txt";
        let content = Bytes::from_static(b"test content");
        let response_data = bucket.put_object(path, content.chunk()).await.unwrap();

        assert_eq!(response_data.status_code(), 200);

        let resp = bucket.get_object("test.txt").await.unwrap();
        assert_eq!(resp.status_code(), 200);

        let resp = bucket.delete_object("test.txt").await.unwrap();
        assert_eq!(resp.status_code(), 200);
    }

cargo.toml file

[package]
name = "aps"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# -- Web
axum = "0.7.5"
tower-http = { version = "0.5.2", features = ["catch-panic", "trace"] }
http = "1.1.0"
# -- Serde
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.68"
# -- Async
tokio = { version = "1.0", features = ["full"] }
# -- Log
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

# -- Database
sea-orm = { version = "0.12.15", features = [
    "debug-print",
    "runtime-tokio-native-tls",
    "sqlx-mysql",
    "mock",
] }

rust-s3 = { version = "0.33.0" }

# -- Others
toml = "0.7.4"
bytes = "1.6.0"
chrono = "0.4"
clap = { version = "4.5.4", features = ["derive"] }
tempfile = "3.10.1"

[dev-dependencies]
tower = { version = "0.4", features = ["util"] }
http-body-util = "0.1.0"
reqwest = "0.12.3"

Expected behavior
i expected delete successfully .thanks!

Environment

  • Rust version: [ 1.76]
  • lib version [0.33.0"]
@durch
Copy link
Owner

durch commented Aug 30, 2024

@maojinhua, can't really be sure, DELETE has a pretty good test coverage, so I'd expect it to work. Not sure where you're running this, but a "" region will likely cause problems...

@durch durch closed this as completed Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants