aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Storage Signature Mismatch on PUT #8840

Closed AdonousTech closed 3 years ago

AdonousTech commented 3 years ago

Before opening, please confirm:

This is the same issue as described here, except I am using Angular instead of React https://github.com/aws-amplify/amplify-js/issues/8783

JavaScript Framework

Angular

Amplify APIs

Authentication, Storage

Amplify Categories

auth, storage

Environment information

``` # Put output below this line System: OS: Windows 10 10.0.19043 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Memory: 3.74 GB / 15.88 GB Binaries: Node: 14.17.1 - C:\Program Files\nodejs\node.EXE npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.84) Internet Explorer: 11.0.19041.906 npmPackages: @angular-devkit/build-angular: ~12.2.3 => 12.2.3 @angular/animations: ^12.2.3 => 12.2.3 @angular/animations/browser: undefined () @angular/animations/browser/testing: undefined () @angular/cdk: ^12.2.3 => 12.2.3 @angular/cdk/a11y: undefined () @angular/cdk/accordion: undefined () @angular/cdk/bidi: undefined () @angular/cdk/clipboard: undefined () @angular/cdk/coercion: undefined () @angular/cdk/collections: undefined () @angular/cdk/drag-drop: undefined () @angular/cdk/keycodes: undefined () @angular/cdk/layout: undefined () @angular/cdk/observers: undefined () @angular/cdk/overlay: undefined () @angular/cdk/platform: undefined () @angular/cdk/portal: undefined () @angular/cdk/scrolling: undefined () @angular/cdk/stepper: undefined () @angular/cdk/table: undefined () @angular/cdk/testing: undefined () @angular/cdk/testing/protractor: undefined () @angular/cdk/testing/selenium-webdriver: undefined () @angular/cdk/testing/testbed: undefined () @angular/cdk/text-field: undefined () @angular/cdk/tree: undefined () @angular/cli: ~12.2.3 => 12.2.3 @angular/common: ^12.2.3 => 12.2.3 @angular/common/http: undefined () @angular/common/http/testing: undefined () @angular/common/testing: undefined () @angular/common/upgrade: undefined () @angular/compiler: ^12.2.3 => 12.2.3 (9.0.0) @angular/compiler-cli: ^12.2.3 => 12.2.3 @angular/compiler/testing: undefined () @angular/core: ^12.2.3 => 12.2.3 (9.0.0) @angular/core/testing: undefined () @angular/forms: ^12.2.3 => 12.2.3 @angular/language-service: ^12.2.3 => 12.2.3 @angular/localize: ^12.2.3 => 12.2.3 @angular/localize/init: undefined () @angular/material: ^12.2.3 => 12.2.3 @angular/material/autocomplete: undefined () @angular/material/autocomplete/testing: undefined () @angular/material/badge: undefined () @angular/material/badge/testing: undefined () @angular/material/bottom-sheet: undefined () @angular/material/bottom-sheet/testing: undefined () @angular/material/button: undefined () @angular/material/button-toggle: undefined () @angular/material/button-toggle/testing: undefined () @angular/material/button/testing: undefined () @angular/material/card: undefined () @angular/material/card/testing: undefined () @angular/material/checkbox: undefined () @angular/material/checkbox/testing: undefined () @angular/material/chips: undefined () @angular/material/chips/testing: undefined () @angular/material/core: undefined () @angular/material/core/testing: undefined () @angular/material/datepicker: undefined () @angular/material/datepicker/testing: undefined () @angular/material/dialog: undefined () @angular/material/dialog/testing: undefined () @angular/material/divider: undefined () @angular/material/divider/testing: undefined () @angular/material/expansion: undefined () @angular/material/expansion/testing: undefined () @angular/material/form-field: undefined () @angular/material/form-field/testing: undefined () @angular/material/form-field/testing/control: undefined () @angular/material/grid-list: undefined () @angular/material/grid-list/testing: undefined () @angular/material/icon: undefined () @angular/material/icon/testing: undefined () @angular/material/input: undefined () @angular/material/input/testing: undefined () @angular/material/list: undefined () @angular/material/list/testing: undefined () @angular/material/menu: undefined () @angular/material/menu/testing: undefined () @angular/material/paginator: undefined () @angular/material/paginator/testing: undefined () @angular/material/progress-bar: undefined () @angular/material/progress-bar/testing: undefined () @angular/material/progress-spinner: undefined () @angular/material/progress-spinner/testing: undefined () @angular/material/radio: undefined () @angular/material/radio/testing: undefined () @angular/material/select: undefined () @angular/material/select/testing: undefined () @angular/material/sidenav: undefined () @angular/material/sidenav/testing: undefined () @angular/material/slide-toggle: undefined () @angular/material/slide-toggle/testing: undefined () @angular/material/slider: undefined () @angular/material/slider/testing: undefined () @angular/material/snack-bar: undefined () @angular/material/snack-bar/testing: undefined () @angular/material/sort: undefined () @angular/material/sort/testing: undefined () @angular/material/stepper: undefined () @angular/material/stepper/testing: undefined () @angular/material/table: undefined () @angular/material/table/testing: undefined () @angular/material/tabs: undefined () @angular/material/tabs/testing: undefined () @angular/material/toolbar: undefined () @angular/material/toolbar/testing: undefined () @angular/material/tooltip: undefined () @angular/material/tooltip/testing: undefined () @angular/material/tree: undefined () @angular/material/tree/testing: undefined () @angular/platform-browser: ^12.2.3 => 12.2.3 @angular/platform-browser-dynamic: ^12.2.3 => 12.2.3 @angular/platform-browser-dynamic/testing: undefined () @angular/platform-browser/animations: undefined () @angular/platform-browser/testing: undefined () @angular/router: ^12.2.3 => 12.2.3 @angular/router/testing: undefined () @angular/router/upgrade: undefined () @aws-amplify/auth: ^4.3.1 => 4.3.1 @aws-amplify/core: ^4.2.5 => 4.2.5 @aws-amplify/pubsub: ^4.1.3 => 4.1.3 @aws-amplify/storage: ^4.3.6 => 4.3.6 @aws-sdk/client-dynamodb: ^3.28.0 => 3.28.0 @aws-sdk/client-lambda: ^3.28.0 => 3.28.0 @aws-sdk/client-sqs: ^3.28.0 => 3.28.0 @ng-bootstrap/ng-bootstrap: ^4.2.2 => 4.2.2 @progress/kendo-angular-buttons: ^6.2.1 => 6.2.1 @progress/kendo-angular-common: ^2.0.1 => 2.0.1 @progress/kendo-angular-conversational-ui: ^3.0.1 => 3.0.1 @progress/kendo-angular-dateinputs: ^5.2.2 => 5.2.2 @progress/kendo-angular-dialog: ^5.1.0 => 5.1.0 @progress/kendo-angular-dropdowns: ^5.3.0 => 5.3.0 @progress/kendo-angular-editor: ^2.3.0 => 2.3.0 @progress/kendo-angular-excel-export: ^4.0.1 => 4.0.1 @progress/kendo-angular-grid: ^5.3.1 => 5.3.1 @progress/kendo-angular-inputs: ^7.3.2 => 7.3.2 @progress/kendo-angular-intl: ^3.1.1 => 3.1.1 @progress/kendo-angular-l10n: ^3.0.2 => 3.0.2 @progress/kendo-angular-label: ^3.1.0 => 3.1.0 @progress/kendo-angular-menu: ^3.0.2 => 3.0.2 @progress/kendo-angular-pdf-export: ^3.0.1 => 3.0.1 @progress/kendo-angular-popup: ^4.0.1 => 4.0.1 @progress/kendo-angular-toolbar: ^4.1.1 => 4.1.1 @progress/kendo-angular-treeview: ^5.4.0 => 5.4.0 @progress/kendo-data-query: ^1.5.5 => 1.5.5 @progress/kendo-drawing: ^1.11.0 => 1.11.0 @progress/kendo-licensing: ^1.2.0 => 1.2.0 @progress/kendo-theme-bootstrap: ^4.17.0 => 4.17.0 @progress/kendo-theme-default: ^4.17.0 => 4.17.0 (4.19.0) @types/jasmine: ~3.6.0 => 3.6.11 @types/jasminewd2: ^2.0.8 => 2.0.8 @types/node: ^16.7.7 => 16.7.7 angular-svg-round-progressbar: ^3.0.1 => 3.0.1 bootstrap: ^4.5.0 => 4.5.0 class-transformer: ^0.2.0 => 0.2.3 codelyzer: ^6.0.0 => 6.0.2 core-js: ^3.16.4 => 3.16.4 (3.16.0) example-typescript: 1.0.0 jasmine-core: ~3.6.0 => 3.6.0 (2.8.0, 3.9.0) jasmine-spec-reporter: ~5.0.0 => 5.0.2 json-stable-stringify: ^1.0.1 => 1.0.1 jwt-decode: ^3.1.2 => 3.1.2 karma: ~6.3.4 => 6.3.4 karma-chrome-launcher: ~3.1.0 => 3.1.0 karma-coverage-istanbul-reporter: ~3.0.2 => 3.0.3 karma-jasmine: ~4.0.0 => 4.0.1 karma-jasmine-html-reporter: ^1.5.0 => 1.5.4 lib: 0.0.1 localforage: ^1.10.0 => 1.10.0 lodash: ^4.17.21 => 4.17.21 moment: ^2.29.1 => 2.29.1 node-example: 1.0.0 papaparse: ^5.3.1 => 5.3.1 placeholder-loading: ^0.5.0 => 0.5.0 process: ^0.11.10 => 0.11.10 protractor: ~7.0.0 => 7.0.0 protractor-example: 1.0.0 rxjs: ^6.6.7 => 6.6.7 (7.3.0) rxjs/ajax: undefined () rxjs/fetch: undefined () rxjs/internal-compatibility: undefined () rxjs/operators: undefined () rxjs/testing: undefined () rxjs/webSocket: undefined () ts-node: ^10.2.1 => 10.2.1 tslib: ^2.3.1 => 2.3.1 (1.14.1, 2.3.0, 2.1.0) tslint: ~6.1.3 => 6.1.3 typescript: 4.3.5 => 4.3.5 typescript-example: 1.0.0 uuid: ^8.3.2 => 8.3.2 (3.4.0) zone-mix: undefined () zone-node: undefined () zone-testing: undefined () zone.js: ~0.11.4 => 0.11.4 (0.10.3) zone.js/async-test: undefined () zone.js/async-test.min: undefined () zone.js/fake-async-test: undefined () zone.js/fake-async-test.min: undefined () zone.js/jasmine-patch: undefined () zone.js/jasmine-patch.min: undefined () zone.js/long-stack-trace-zone: undefined () zone.js/long-stack-trace-zone.min: undefined () zone.js/mocha-patch: undefined () zone.js/mocha-patch.min: undefined () zone.js/proxy: undefined () zone.js/proxy.min: undefined () zone.js/sync-test: undefined () zone.js/sync-test.min: undefined () zone.js/task-tracking: undefined () zone.js/task-tracking.min: undefined () zone.js/webapis-media-query: undefined () zone.js/webapis-media-query.min: undefined () zone.js/webapis-notification: undefined () zone.js/webapis-notification.min: undefined () zone.js/webapis-rtc-peer-connection: undefined () zone.js/webapis-rtc-peer-connection.min: undefined () zone.js/webapis-shadydom: undefined () zone.js/webapis-shadydom.min: undefined () zone.js/wtf: undefined () zone.js/wtf.min: undefined () zone.js/zone-bluebird: undefined () zone.js/zone-bluebird.min: undefined () zone.js/zone-error: undefined () zone.js/zone-error.min: undefined () zone.js/zone-legacy: undefined () zone.js/zone-legacy.min: undefined () zone.js/zone-patch-canvas: undefined () zone.js/zone-patch-canvas.min: undefined () zone.js/zone-patch-cordova: undefined () zone.js/zone-patch-cordova.min: undefined () zone.js/zone-patch-electron: undefined () zone.js/zone-patch-electron.min: undefined () zone.js/zone-patch-fetch: undefined () zone.js/zone-patch-fetch.min: undefined () zone.js/zone-patch-jsonp: undefined () zone.js/zone-patch-jsonp.min: undefined () zone.js/zone-patch-message-port: undefined () zone.js/zone-patch-message-port.min: undefined () zone.js/zone-patch-promise-test: undefined () zone.js/zone-patch-promise-test.min: undefined () zone.js/zone-patch-resize-observer: undefined () zone.js/zone-patch-resize-observer.min: undefined () zone.js/zone-patch-rxjs: undefined () zone.js/zone-patch-rxjs-fake-async: undefined () zone.js/zone-patch-rxjs-fake-async.min: undefined () zone.js/zone-patch-rxjs.min: undefined () zone.js/zone-patch-socket-io: undefined () zone.js/zone-patch-socket-io.min: undefined () zone.js/zone-patch-user-media: undefined () zone.js/zone-patch-user-media.min: undefined () npmGlobalPackages: @adonoustech/ngx-tw-animations: 0.0.1 @adonoustech/ngx-tw-layout: 0.0.1 @angular-devkit/schematics-cli: 12.1.2 @angular/cli: 11.1.1 @aws-amplify/cli: 0.1.45 @ionic/cli: 6.16.3 adonoustech-angular: 0.0.0 ask-cli: 2.24.1 aws-cdk: 1.87.1 cordova-res: 0.15.2 express-generator: 4.16.0 generator-office: 1.7.5 gluegun: 3.3.0 lerna: 4.0.0 native-run: 1.3.0 rxjs-tslint: 0.1.5 sync-files: 1.0.3 undefined: 0.1.0 windows-build-tools: 5.2.2 yo: 3.1.1 ```

Describe the bug

import { environment } from './environments/environment';

export const AuthConfig = {
    identityPoolId: environment.identityPoolId,
    region: environment.region,
    identityPoolRegion: environment.region,
    userPoolId: environment.userPoolId,
    userPoolWebClientId: environment.webclientId,
}

export const PubSubConfig = {
    aws_pubsub_region: 'us-west-2',
    aws_pubsub_endpoint: '[OMITTED]'
}
export const StorageConfig = {
    AWSS3: {
        bucket: environment.clientStorageBucket,
        region: environment.region
      }
}
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { AuthConfig,
         PubSubConfig,
         InteractionsConfig,
         StorageConfig } from './amplify-config';

import Amplify from '@aws-amplify/core';
import { AWSIoTProvider } from '@aws-amplify/pubsub';

Amplify.configure({
  Auth: AuthConfig,
  PubSub: PubSubConfig,
  Interactions: InteractionsConfig,
  Storage: StorageConfig
});

Amplify.addPluggable(new AWSIoTProvider());

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

Expected behavior

Reproduction steps

  1. Create a new Angular app and manually configure Auth and Storage
  2. Authenticate a user and try performing a PUT action via @aws-amplify/storage APIS (example below):

Code Snippet

// Put your code below this line.

  addFolder(frm: any) {
    Storage.put(this.itemDirectory + frm.txtFolderName + '/', '', { level: 'protected'}).then(
        (addFolderResult) => {
          ...
        }
      ).catch(
        (addFolderError) => {
          const errorMessage = 'An error occured while attempting to add a directory to storage.';
         console.error(addFolderError);
          ...
        }
      )
  }

Log output

``` // Put your logs below this line SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.ASIA5X4W6357RI5IBOE4AWS4-HMAC-SHA256 20210902T185922Z 20210902/us-west-2/s3/aws4_request 3c8946d9a19e8e61b8b5ffe435d7ebf22642dfab73ed667c0b390513930908d5671da86d71e0584f3b8849253e6a2466d84bcb5e6fcee00a780e66dd89d618c941 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 31 30 39 30 32 54 31 38 35 39 32 32 5a 0a 32 30 32 31 30 39 30 32 2f 75 73 2d 77 65 73 74 2d 32 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 33 63 38 39 34 36 64 39 61 31 39 65 38 65 36 31 62 38 62 35 66 66 65 34 33 35 64 37 65 62 66 32 32 36 34 32 64 66 61 62 37 33 65 64 36 36 37 63 30 62 33 39 30 35 31 33 39 33 30 39 30 38 64 35PUT /protected/us-west-2%3Ae000f34d-6dfb-4e1c-a874-0f202fd438c7/Test%20Folder/ x-id=PutObject amz-sdk-invocation-id:3b0a1fdd-1256-40b8-bd3a-b94d7f1a452e amz-sdk-request:attempt=1; max=3 content-type: host:lha-dev-clients-storage.s3.us-west-2.amazonaws.com x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 x-amz-date:20210902T185922Z x-amz-security-token:IQoJb3JpZ2luX2VjENP//////////wEaCXVzLXdlc3QtMiJHMEUCIQCym4Ot5UeLMhHH1I8SnqVwA6ybPsRhfl19A02iK7xA8gIgHqWfUlfTzd4B/8kgjTPt0WrjJp6IOfc3U/04VKB10TgqxAQIHBACGgw5NDQ2NzI1MzAzMDMiDHbQguPb4JyWDpw4aiqhBIZnNgArVv6FscZrV6dXVF8yVW3NISFa8J/BtsSdTeFE4tmKLCFUo5iVN5ZA4mcukJYBvN7SLzCP/30IEmffSoCy+Jhw79l71vlNsFQYxeRX3b44x8uUaPx1q1v+/sxwD1hO/y1QqEnNm+BKuYk8KR4H4AgJRhgP2JKwprOns71YCkE7fEwUn2rAmMoCfmJrM04I90kJChQgFU/PsK8Rke7EUW/7PdkvrxvVjrwpmBa+UTY3XynZNNzPaT4ZLVVR3cc5uifklhDYxwEgWavomCMyVQsPzhrH/lb+eaKywmj4556IfvVWQFi3BLEDYhv2UcCQZRmsMQK4tyWOSpk3B7VKciKt4Xuk8sftL/f/zb1W9iL8R3ZfbsPrG1j0GObE37/C2swMAOAv+vX4yc/Nv0vg0UoL3/NrXz3EIHzmZaBRpNVpk/v4b8ir4YOVuyuzZ0NYKCytxDFlDf8v2/HU/BftEd52CGHg7imoOkS4r9q96YWq68UGzKqEvW1GwdL+2UmAcBhbIGcR+TXHrqPJS4Q9ggCyJuWkifVFICOsWuhr5uzb7Fh/jx6l2jtVbPcuxtd0Pp+1NqD/Ui8HzI3lAInEZuvJxcl2tbedAfbzE1fnPHqZztJvvwjOrmgQWLYl4ccheMxaxiZ/THE8epKSwb3TaW3dBkhwH/h4JXOKmEx7CYDwGPNBDGJKUl8SBib8dYRqRx22nzhNrkKGoTdZ6+nYMPe9xIkGOoUC3+Y7rjHzIBi84Fx7BOwKes4154NFzRs49WCSwpKCHr61QMp/ZXcPuTMFLwwva7pQTFZQ/ODE6bWm48un3fIiaFx5iPoMN5jfGeMKLUj1Wyq+e8szZqjD5jb/U8S7zErNPs128t3IaRKvL+Di7E6jKaI38mClovk2CAGXO7kdZHWJme7jDE8hoP4St6k7OXOgGn79Ht5OWpSk6zQ4I8m3weaHI63wMI3rkBzRPMs8x1VX4K24Q9xxBASArbg1cP+NIJmwJHGbyPgiTDvVQIpIHFvwQzfjRsw7yU+ndmtwCjJeTMY0F5ZNvpMmAdMt2bqkPqErecpnioMUHV575oGJRMls2i+E x-amz-user-agent:aws-sdk-js/3.6.1 os/Windows/NT_10.0 lang/js md/browser/Microsoft_Edge_92.0.902.84 api/s3/3.6.1 aws-amplify/4.2.4_js amz-sdk-invocation-id;amz-sdk-request;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85550 55 54 0a 2f 70 72 6f 74 65 63 74 65 64 2f 75 73 2d 77 65 73 74 2d 32 25 33 41 65 30 30 30 66 33 34 64 2d 36 64 66 62 2d 34 65 31 63 2d 61 38 37 34 2d 30 66 32 30 32 66 64 34 33 38 63 37 2f 54 65 73 74 25 32 30 46 6f 6c 64 65 72 2f 0a 78 2d 69 64 3d 50 75 74 4f 62 6a 65 63 74 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3a 33 62 30 61 31 66 64 64 2d 31 32 35 36 2d 34 30 62 38 2d 62 64 33 61 2d 62 39 34 64 37 66 31 61 34 35 32 65 0a 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3a 61 74 74 65 6d 70 74 3d 31 3b 20 6d 61 78 3d 33 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 0a 68 6f 73 74 3a 6c 68 61 2d 64 65 76 2d 63 6c 69 65 6e 74 73 2d 73 74 6f 72 61 67 65 2e 73 33 2e 75 73 2d 77 65 73 74 2d 32 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 32 31 30 39 30 32 54 31 38 35 39 32 32 5a 0a 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3a 49 51 6f 4a 62 33 4a 70 5a 32 6c 75 58 32 56 6a 45 4e 50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 77 45 61 43 58 56 7a 4c 58 64 6c 63 33 51 74 4d 69 4a 48 4d 45 55 43 49 51 43 79 6d 34 4f 74 35 55 65 4c 4d 68 48 48 31 49 38 53 6e 71 56 77 41 36 79 62 50 73 52 68 66 6c 31 39 41 30 32 69 4b 37 78 41 38 67 49 67 48 71 57 66 55 6c 66 54 7a 64 34 42 2f 38 6b 67 6a 54 50 74 30 57 72 6a 4a 70 36 49 4f 66 63 33 55 2f 30 34 56 4b 42 31 30 54 67 71 78 41 51 49 48 42 41 43 47 67 77 35 4e 44 51 32 4e 7a 49 31 4d 7a 41 7a 4d 44 4d 69 44 48 62 51 67 75 50 62 34 4a 79 57 44 70 77 34 61 69 71 68 42 49 5a 6e 4e 67 41 72 56 76 36 46 73 63 5a 72 56 36 64 58 56 46 38 79 56 57 33 4e 49 53 46 61 38 4a 2f 42 74 73 53 64 54 65 46 45 34 74 6d 4b 4c 43 46 55 6f 35 69 56 4e 35 5a 41 34 6d 63 75 6b 4a 59 42 76 4e 37 53 4c 7a 43 50 2f 33 30 49 45 6d 66 66 53 6f 43 79 2b 4a 68 77 37 39 6c 37 31 76 6c 4e 73 46 51 59 78 65 52 58 33 62 34 34 78 38 75 55 61 50 78 31 71 31 76 2b 2f 73 78 77 44 31 68 4f 2f 79 31 51 71 45 6e 4e 6d 2b 42 4b 75 59 6b 38 4b 52 34 48 34 41 67 4a 52 68 67 50 32 4a 4b 77 70 72 4f 6e 73 37 31 59 43 6b 45 37 66 45 77 55 6e 32 72 41 6d 4d 6f 43 66 6d 4a 72 4d 30 34 49 39 30 6b 4a 43 68 51 67 46 55 2f 50 73 4b 38 52 6b 65 37 45 55 57 2f 37 50 64 6b 76 72 78 76 56 6a 72 77 70 6d 42 61 2b 55 54 59 33 58 79 6e 5a 4e 4e 7a 50 61 54 34 5a 4c 56 56 52 33 63 63 35 75 69 66 6b 6c 68 44 59 78 77 45 67 57 61 76 6f 6d 43 4d 79 56 51 73 50 7a 68 72 48 2f 6c 62 2b 65 61 4b 79 77 6d 6a 34 35 35 36 49 66 76 56 57 51 46 69 33 42 4c 45 44 59 68 76 32 55 63 43 51 5a 52 6d 73 4d 51 4b 34 74 79 57 4f 53 70 6b 33 42 37 56 4b 63 69 4b 74 34 58 75 6b 38 73 66 74 4c 2f 66 2f 7a 62 31 57 39 69 4c 38 52 33 5a 66 62 73 50 72 47 31 6a 30 47 4f 62 45 33 37 2f 43 32 73 77 4d 41 4f 41 76 2b 76 58 34 79 63 2f 4e 76 30 76 67 30 55 6f 4c 33 2f 4e 72 58 7a 33 45 49 48 7a 6d 5a 61 42 52 70 4e 56 70 6b 2f 76 34 62 38 69 72 34 59 4f 56 75 79 75 7a 5a 30 4e 59 4b 43 79 74 78 44 46 6c 44 66 38 76 32 2f 48 55 2f 42 66 74 45 64 35 32 43 47 48 67 37 69 6d 6f 4f 6b 53 34 72 39 71 39 36 59 57 71 36 38 55 47 7a 4b 71 45 76 57 31 47 77 64 4c 2b 32 55 6d 41 63 42 68 62 49 47 63 52 2b 54 58 48 72 71 50 4a 53 34 51 39 67 67 43 79 4a 75 57 6b 69 66 56 46 49 43 4f 73 57 75 68 72 35 75 7a 62 37 46 68 2f 6a 78 36 6c 32 6a 74 56 62 50 63 75 78 74 64 30 50 70 2b 31 4e 71 44 2f 55 69 38 48 7a 49 33 6c 41 49 6e 45 5a 75 76 4a 78 63 6c 32 74 62 65 64 41 66 62 7a 45 31 66 6e 50 48 71 5a 7a 74 4a 76 76 77 6a 4f 72 6d 67 51 57 4c 59 6c 34 63 63 68 65 4d 78 61 78 69 5a 2f 54 48 45 38 65 70 4b 53 77 62 33 54 61 57 33 64 42 6b 68 77 48 2f 68 34 4a 58 4f 4b 6d 45 78 37 43 59 44 77 47 50 4e 42 44 47 4a 4b 55 6c 38 53 42 69 62 38 64 59 52 71 52 78 32 32 6e 7a 68 4e 72 6b 4b 47 6f 54 64 5a 36 2b 6e 59 4d 50 65 39 78 49 6b 47 4f 6f 55 43 33 2b 59 37 72 6a 48 7a 49 42 69 38 34 46 78 37 42 4f 77 4b 65 73 34 31 35 34 4e 46 7a 52 73 34 39 57 43 53 77 70 4b 43 48 72 36 31 51 4d 70 2f 5a 58 63 50 75 54 4d 46 4c 77 77 76 61 37 70 51 54 46 5a 51 2f 4f 44 45 36 62 57 6d 34 38 75 6e 33 66 49 69 61 46 78 35 69 50 6f 4d 4e 35 6a 66 47 65 4d 4b 4c 55 6a 31 57 79 71 2b 65 38 73 7a 5a 71 6a 44 35 6a 62 2f 55 38 53 37 7a 45 72 4e 50 73 31 32 38 74 33 49 61 52 4b 76 4c 2b 44 69 37 45 36 6a 4b 61 49 33 38 6d 43 6c 6f 76 6b 32 43 41 47 58 4f 37 6b 64 5a 48 57 4a 6d 65 37 6a 44 45 38 68 6f 50 34 53 74 36 6b 37 4f 58 4f 67 47 6e 37 39 48 74 35 4f 57 70 53 6b 36 7a 51 34 49 38 6d 33 77 65 61 48 49 36 33 77 4d 49 33 72 6b 42 7a 52 50 4d 73 38 78 31 56 58 34 4b 32 34 51 39 78 78 42 41 53 41 72 62 67 31 63 50 2b 4e 49 4a 6d 77 4a 48 47 62 79 50 67 69 54 44 76 56 51 49 70 49 48 46 76 77 51 7a 66 6a 52 73 77 37 79 55 2b 6e 64 6d 74 77 43 6a 4a 65 54 4d 59 30 46 35 5a 4e 76 70 4d 6d 41 64 4d 74 32 62 71 6b 50 71 45 72 65 63 70 6e 69 6f 4d 55 48 56 35 37 35 6f 47 4a 52 4d 6c 73 32 69 2b 45 0a 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 3a 61 77 73 2d 73 64 6b 2d 6a 73 2f 33 2e 36 2e 31 20 6f 73 2f 57 69 6e 64 6f 77 73 2f 4e 54 5f 31 30 2e 30 20 6c 61 6e 67 2f 6a 73 20 6d 64 2f 62 72 6f 77 73 65 72 2f 4d 69 63 72 6f 73 6f 66 74 5f 45 64 67 65 5f 39 32 2e 30 2e 39 30 32 2e 38 34 20 61 70 69 2f 73 33 2f 33 2e 36 2e 31 20 61 77 73 2d 61 6d 70 6c 69 66 79 2f 34 2e 32 2e 34 5f 6a 73 0a 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3b 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3b 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 3b 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3b 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 0a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35BRZ4HJD5NZXPG5FJprr1VJ2YvDCxwP+LabC18MhX0KacI5BIf//3E1YV7OogdHU3beSloJDkRDMUXGFBeM/Wry39yO0= ```

aws-exports.js

import { environment } from './environments/environment';

export const AuthConfig = {
    identityPoolId: environment.identityPoolId,
    region: environment.region,
    identityPoolRegion: environment.region,
    userPoolId: environment.userPoolId,
    userPoolWebClientId: environment.webclientId,
}

export const PubSubConfig = {
    aws_pubsub_region: 'us-west-2',
    aws_pubsub_endpoint: '[OMITTED]'
}
export const StorageConfig = {
    AWSS3: {
        bucket: environment.clientStorageBucket,
        region: environment.region
      }
}

Manual configuration

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { AuthConfig,
         PubSubConfig,
         InteractionsConfig,
         StorageConfig } from './amplify-config';

import Amplify from '@aws-amplify/core';
import { AWSIoTProvider } from '@aws-amplify/pubsub';

Amplify.configure({
  Auth: AuthConfig,
  PubSub: PubSubConfig,
  Interactions: InteractionsConfig,
  Storage: StorageConfig
});

Amplify.addPluggable(new AWSIoTProvider());

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

Additional configuration


{
    "UserPool": {
        "Id": "[OMITTED]",
        "Name": "lha-dev",
        "Policies": {
            "PasswordPolicy": {
                "MinimumLength": 8,
                "RequireUppercase": true,
                "RequireLowercase": true,
                "RequireNumbers": true,
                "RequireSymbols": true
            }
        },
        "LambdaConfig": {
            "PostConfirmation": "[OMITTED]"
        },
        "LastModifiedDate": 1567103120.726,
        "CreationDate": 1565980119.859,
        "SchemaAttributes": [
            {
                "Name": "sub",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": false,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "1",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "given_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "family_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "middle_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "nickname",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "preferred_username",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "profile",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "picture",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "website",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "gender",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "birthdate",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "10",
                    "MaxLength": "10"
                }
            },
            {
                "Name": "zoneinfo",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "locale",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "address",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "updated_at",
                "AttributeDataType": "Number",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "NumberAttributeConstraints": {
                    "MinValue": "0"
                }
            },
            {
                "Name": "identities",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {}
            }
        ],
        "AutoVerifiedAttributes": [
            "email"
        ],
        "VerificationMessageTemplate": {
            "DefaultEmailOption": "CONFIRM_WITH_CODE"
        },
        "MfaConfiguration": "OFF",
        "EstimatedNumberOfUsers": 5,
        "EmailConfiguration": {},
        "UserPoolTags": {},
        "Domain": "lendahandaccounting",
        "AdminCreateUserConfig": {
            "AllowAdminCreateUserOnly": false,
            "UnusedAccountValidityDays": 7
        },
        "Arn": "[OMITTED]"
    }
}

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

chrisbonifacio commented 3 years ago

Hi @AdonousTech 👋 Thanks for raising this issue. What version are you upgrading from and how are you importing and using the Storage module? This is only affecting your PUT requests whereas GET is still working as expected for you?

AdonousTech commented 3 years ago

@chrisbonifacio - thanks for getting back on this. I am upgrading from "aws-amplify": "^1.3.3" I am upgrading as part of a larger upgrade from Angular v9 => 12. Consequently, I need to use the latest versions with the bifurcated packages (e.g. core, auth, storage, etc.).

chrisbonifacio commented 3 years ago

@AdonousTech After speaking with the team, this isn't technically possible or how S3 works. S3 stores files as Objects with the "path" to the file as a key to access them. It may seem like there are folders in the S3 console but that's just how it visually organizes the files.

Here's a link to the documentation for more information.

This is particularly relevant

The Amazon S3 data model is a flat structure: You create a bucket, and the bucket store objects. There is no hierarchy of subbuckets or subfolders. However, you can infer logical hierarchy using key name prefixes and delimiters as the Amazon S3 console does. The Amazon S3 console supports a concept of folders.

If you really need to create or display an "empty folder" for your UI you may try a workaround similar to this:

AdonousTech commented 3 years ago

@chrisbonifacio Yes, I read that as well. Somehow I was able to get a hack working prior to the amplify update. I've been doing this in production for a couple of years, with no issues.

Good to know this is not a systemic issue and related only to creating empty "directories". Although, it would be helpful to have a more accurate error message.

I will look into the suggestions above. Thanks for your help, I really appreciate it!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.