Closed mbahmani90 closed 6 months ago
@mbahmani90 You need to update the latest version of Amplify (2.16.0) to use StoragePath. The version you have reported does not have it. Instead, you would use the other methods that take a key: String
which are marked in documentation as deprecated.
I update amplify to 2.16.0 and it is now found. However, when I run:
Amplify.Storage.uploadInputStream(StoragePath.fromIdentityId { identityId ->
"test/${fileName}"
}, stream, { onComplete() },
{
app.l("$it")
onError() })
I am receiving the following error:
StorageException{message=Something went wrong with your AWS S3 Storage upload InputStream operation, cause=java.lang.Exception: aws.sdk.kotlin.services.s3.model.S3Exception: Access Denied, recoverySuggestion=See attached exception for more information and suggestions}
It is just work fine when I replace:
"test/${fileName}"
with
"private/${identityId}/test/${fileName}"
Thanks
I had to write
"public/test/${fileName}"
Now it works. :) Many thanks.
@mbahmani90 Thats great! Make sure to follow access control (public/private/protected) guidelines here: https://docs.amplify.aws/android/build-a-backend/storage/storagepath/.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Before opening, please confirm:
Language and Async Model
Kotlin, Kotlin - Coroutines
Amplify Categories
Storage
Gradle script dependencies
Environment information
-
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
Hi,
I want to use StoragePath in kotlin android to upload my file in s3 storage. According to https://docs.amplify.aws/android/build-a-backend/storage/storagepath/#create-a-storagepath-from-string I should use the following command. StoragePath.fromString("public/exampleFile.txt")
But StoragePath is not found!
I can store file in s3 without any issue. However, I need StoragePath to store files in specific directory.
Thanks
Reproduction steps (if applicable)
No response
Code Snippet
Log output
amplifyconfiguration.json
No response
GraphQL Schema
Additional information and screenshots
No response