Skip to content

Metadata not being retrieved (add CORS info to docs) #4099

Open
@Tyga76

Description

@Tyga76

Description

I have successfully uploaded documents to my S3 bucket. I have added user-defined metadata that I can see on the object properties in the S3 console. However when I use Amplify.Storage.getProperties, it does not pull the metadata.

`

Future<List<StorageItem>?> listBucketByPath(String path) async {
    try {
      String? nextToken;
      bool hasNextPage;
      List<StorageItem>? files = [];
      do {
        final result = await Amplify.Storage.list(
          path: path,
          options: StorageListOptions(
            accessLevel: StorageAccessLevel.guest,
            pageSize: 5,
            nextToken: nextToken,
            pluginOptions: const S3ListPluginOptions(
              excludeSubPaths: false,
            ),
          ),
        ).result;
        _logger.e('Listed items: ${result.items}');
        for (final item in result.items) {
          final metadata = await Amplify.Storage.getProperties(
                  key: item.key,
                  options: const StorageGetPropertiesOptions(
                      accessLevel: StorageAccessLevel.guest))
              .result;
           _logger.e(metadata);
        }
        result.items.isNotEmpty ? files.addAll(result.items) : files.addAll([]);
        nextToken = result.nextToken;
        hasNextPage = result.hasNextPage;
      } while (hasNextPage);

      return files;
    } on StorageException catch (e) {
      _logger.e('Error listing files: ${e.message}');
      rethrow;
    }
  }

`

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.13.9

Amplify Flutter Version

1.0.4

Deployment Method

Amplify CLI

Schema

No response

Metadata

Metadata

Assignees

Labels

DocumentationImprovements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).feature-requestA request for a new feature or an enhancement to an existing API or category.storageIssues related to the Storage Category

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions