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

NotImplemented: A header you provided implies functionality that is not implemented - AWS Amplify Storage remove() #13133

Closed
3 tasks done
ChristopherGabba opened this issue Mar 17, 2024 · 29 comments
Assignees
Labels
Gen 2 Issues related to Gen 2 Amplify projects not-reproducible Not able to reproduce the issue pending-triage Issue is pending triage React Native React Native related issue Storage Related to Storage components/category

Comments

@ChristopherGabba
Copy link

ChristopherGabba commented Mar 17, 2024

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Storage

Amplify Version

v6

Amplify Categories

storage

Backend

Amplify Gen 2 (Preview)

Environment information

  System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 1.26 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.7.0 - /opt/homebrew/bin/node
    npm: 10.1.0 - /opt/homebrew/bin/npm
    Watchman: 2023.09.04.00 - /opt/homebrew/bin/watchman
  Browsers:
    Safari: 17.2.1
  npmPackages:
    @aws-amplify/react-native: ^1.0.12 => 1.0.17 
    @babel/core: ^7.20.0 => 7.23.9 
    @babel/plugin-proposal-export-namespace-from: ^7.18.9 => 7.18.9 
    @babel/plugin-transform-runtime: ^7.23.9 => 7.23.9 
    @babel/preset-env: ^7.20.0 => 7.23.9 
    @babel/runtime: ^7.20.0 => 7.23.9 
    @config-plugins/ffmpeg-kit-react-native: ^7.0.0 => 7.0.0 
    @expo-google-fonts/m-plus-1p: ^0.2.3 => 0.2.3 
    @expo-google-fonts/montserrat: ^0.2.3 => 0.2.3 
    @expo-google-fonts/space-grotesk: ^0.2.2 => 0.2.3 
    @expo/config-plugins: ~7.8.0 => 7.8.4 (5.0.4)
    @expo/metro-config: ~0.17.1 => 0.17.4 
    @gorhom/bottom-sheet: ^4.4.7 => 4.6.1 
    @likashefqet/react-native-image-zoom: ^2.1.1 => 2.2.0 
    @react-native-async-storage/async-storage: ^1.18.2 => 1.22.1 
    @react-native-clipboard/clipboard: ^1.11.2 => 1.13.2 
    @react-native-community/cli-platform-ios: ^8.0.2 => 8.0.6 (12.3.2)
    @react-native-community/netinfo: 11.1.0 => 11.1.0 
    @react-navigation/bottom-tabs: ^6.3.2 => 6.5.12 
    @react-navigation/native: ^6.0.2 => 6.1.10 
    @react-navigation/native-stack: ^6.0.2 => 6.9.18 
    @rnx-kit/metro-config: ^1.3.5 => 1.3.14 
    @rnx-kit/metro-resolver-symlinks: ^0.1.26 => 0.1.35 
    @sentry/react-native: 5.19.1 => 5.19.1 
    @shopify/flash-list: 1.6.3 => 1.6.3 
    @types/i18n-js: 3.8.2 => 3.8.2 
    @types/jest: ^29.2.1 => 29.5.12 
    @types/lodash.filter: ^4.6.9 => 4.6.9 
    @types/react: ~18.2.14 => 18.2.57 
    @types/react-test-renderer: ^18.0.0 => 18.0.7 
    @typescript-eslint/eslint-plugin: ^5.59.0 => 5.62.0 
    @typescript-eslint/parser: ^5.59.0 => 5.62.0 
    HelloWorld:  0.0.1 
    apisauce: 2.1.5 => 2.1.5 
    aws-amplify: ^6.0.20 => 6.0.20 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    axios: ^1.5.0 => 1.6.7 (0.21.4)
    babel-jest: ^29.2.1 => 29.7.0 
    babel-loader: 8.2.5 => 8.2.5 
    babel-plugin-root-import: ^6.6.0 => 6.6.0 
    cheerio: ^1.0.0-rc.12 => 1.0.0-rc.12 
    core-util-is:  1.0.1 
    date-fns: ^2.29.2 => 2.30.0 
    eslint: 8.17.0 => 8.17.0 
    eslint-config-prettier: 8.5.0 => 8.5.0 
    eslint-config-standard: 17.0.0 => 17.0.0 
    eslint-plugin-import: 2.26.0 => 2.26.0 
    eslint-plugin-n: ^15.0.0 => 15.7.0 
    eslint-plugin-node: 11.1.0 => 11.1.0 
    eslint-plugin-promise: 6.0.0 => 6.0.0 
    eslint-plugin-react: 7.30.0 => 7.30.0 
    eslint-plugin-react-native: 4.0.0 => 4.0.0 
    expo: ^50.0.7 => 50.0.7 
    expo-application: ~5.8.3 => 5.8.3 
    expo-av: ^13.10.5 => 13.10.5 
    expo-blur: ~12.9.2 => 12.9.2 
    expo-build-properties: ~0.11.1 => 0.11.1 
    expo-clipboard: ~5.0.1 => 5.0.1 
    expo-config-plugin-ios-share-extension: ^0.0.4 => 0.0.4 
    expo-constants: ~15.4.5 => 15.4.5 
    expo-contacts: ~12.8.2 => 12.8.2 
    expo-dev-client: ~3.3.8 => 3.3.8 
    expo-device: ~5.9.3 => 5.9.3 
    expo-file-system: ~16.0.6 => 16.0.6 
    expo-font: ~11.10.3 => 11.10.3 
    expo-haptics: ~12.8.1 => 12.8.1 
    expo-image: ~1.10.6 => 1.10.6 
    expo-image-picker: ~14.7.1 => 14.7.1 
    expo-linear-gradient: ~12.7.2 => 12.7.2 
    expo-linking: ~6.2.2 => 6.2.2 
    expo-localization: ~14.8.3 => 14.8.3 
    expo-media-library: ~15.9.1 => 15.9.1 
    expo-notifications: ~0.27.6 => 0.27.6 
    expo-secure-store: ~12.8.1 => 12.8.1 
    expo-splash-screen: ~0.26.4 => 0.26.4 
    expo-status-bar: ~1.11.1 => 1.11.1 
    expo-store-review: ~6.8.3 => 6.8.3 
    expo-updates: ~0.24.11 => 0.24.11 
    expo-video-thumbnails: ~7.9.0 => 7.9.0 
    fbjs-scripts: 3.0.1 => 3.0.1 
    ffmpeg-kit-react-native: ^6.0.2 => 6.0.2 
    i18n-js: 3.9.2 => 3.9.2 
    inherits:  2.0.1 
    isarray:  0.0.1 
    jest: ^29.2.1 => 29.7.0 
    jest-circus: 29 => 29.7.0 
    jest-environment-node: 29 => 29.7.0 
    jest-expo: ~50.0.2 => 50.0.2 
    jsdom: ^22.1.0 => 22.1.0 (20.0.3)
    jsdom-jscore-rn: ^0.1.8 => 0.1.8 
    libphonenumber-js: ^1.10.56 => 1.10.56 
    libphonenumber-js/build:  undefined ()
    libphonenumber-js/core:  undefined ()
    libphonenumber-js/max:  undefined ()
    libphonenumber-js/max/metadata:  undefined ()
    libphonenumber-js/min:  undefined ()
    libphonenumber-js/min/metadata:  undefined ()
    libphonenumber-js/mobile:  undefined ()
    libphonenumber-js/mobile/examples:  undefined ()
    libphonenumber-js/mobile/metadata:  undefined ()
    lodash: ^4.17.21 => 4.17.21 
    lodash.filter: ^4.6.0 => 4.6.0 
    lottie-react-native: 6.5.1 => 6.5.1 
    metro-config: ~0.80.6 => 0.80.6 
    metro-source-map: ^0.80.6 => 0.80.6 
    mobx: 6.6.0 => 6.6.0 
    mobx-react-lite: 3.4.0 => 3.4.0 
    mobx-state-tree: 5.1.5 => 5.1.5 
    mocha: ^10.2.0 => 10.3.0 
    nwmatcher:  1.4.3 
    patch-package: ^6.4.7 => 6.5.1 
    path-browserify:  0.0.0 
    postinstall-prepare: 1.0.1 => 1.0.1 
    prettier: 2.8.8 => 2.8.8 (3.2.5)
    query-string: ^7.0.1 => 7.1.3 (6.10.1)
    querystring:  0.2.0 
    react: 18.2.0 => 18.2.0 
    react-devtools-core: 4.24.7 => 4.24.7 (4.28.5)
    react-dom: 18.2.0 => 18.2.0 
    react-native: 0.73.4 => 0.73.4 
    react-native-blurhash: ^2.0.2 => 2.0.2 
    react-native-bootsplash: ^5.0.2 => 5.4.1 
    react-native-compressor: ^1.8.23 => 1.8.24 
    react-native-context-menu-view: ^1.15.0 => 1.15.0 
    react-native-countdown-circle-timer: ^3.2.1 => 3.2.1 
    react-native-device-info: ^10.12.0 => 10.12.0 
    react-native-dots-pagination: ^0.3.1 => 0.3.1 
    react-native-element-dropdown: ^2.9.0 => 2.10.1 
    react-native-fs: ^2.20.0 => 2.20.0 
    react-native-gesture-handler: ~2.14.0 => 2.14.1 
    react-native-get-random-values: ~1.9.0 => 1.9.0 
    react-native-mmkv: ^2.11.0 => 2.12.1 
    react-native-pager-view: 6.2.3 => 6.2.3 
    react-native-reanimated: ~3.6.2 => 3.6.3 
    react-native-receive-sharing-intent: ^2.0.0 => 2.0.0 
    react-native-render-html: ^6.3.4 => 6.3.4 
    react-native-safe-area-context: 4.8.2 => 4.8.2 
    react-native-screens: ~3.29.0 => 3.29.0 
    react-native-static-safe-area-insets: ^2.2.0 => 2.2.0 
    react-native-touchable-scale: ^2.2.0 => 2.2.0 
    react-native-url-polyfill: ^2.0.0 => 2.0.0 
    react-native-video: ^6.0.0-beta.4 => 6.0.0-beta.5 
    react-native-vision-camera: ^3.8.2 => 3.9.0 
    react-native-volume-manager: ^1.10.0 => 1.10.0 
    react-native-web: ~0.19.6 => 0.19.10 
    react-native-webview: 13.6.4 => 13.6.4 
    react-native-youtube-iframe: ^2.3.0 => 2.3.0 
    react-test-renderer: 18.2.0 => 18.2.0 
    reactotron-core-client: ^2.8.10 => 2.9.2 (2.8.10)
    reactotron-mst: 3.1.4 => 3.1.4 
    reactotron-react-js: ^3.3.7 => 3.3.13 
    reactotron-react-native: 5.0.3 => 5.0.3 
    regenerator-runtime: ^0.13.4 => 0.13.11 (0.14.1)
    string_decoder:  0.10.31 
    ts-jest: 29 => 29.1.2 
    typescript: ^4.9.4 => 5.3.3 
    urlmaster:  0.2.15 
    uuid: ^9.0.1 => 9.0.1 (8.3.2, 7.0.3)
  npmGlobalPackages:
    @aws-amplify/cli-internal: 12.10.1
    @aws-amplify/cli: 12.10.1
    @react-native-community/netinfo: 9.4.1
    eas-cli: 7.5.0
    expo-cli: 6.3.10
    firebase-tools: 11.24.1
    n: 9.1.0
    node-gyp: 10.0.1
    node: 20.6.0
    npm: 10.3.0
    pod-install: 0.2.0
    react-native-spinkit: 1.5.1

Describe the bug

When a post is deleted in my application, I use the list and remove functions from the aws-amplify storage. When it hits the remove() function, occasionally (maybe 1 in 4 post deletions) this error comes up and it fails the deletion.

Expected behavior

This error should not appear and it should successfully delete my post. What is interesting is that I have not changed anything in this function in months and this error started appearing a week ago and I can't pinpoint what it's telling me.

Reproduction steps

Refer to reproducible code below.

Code Snippet

Here is my delete function:

import { list, remove } from "aws-amplify/storage"
import { generateClient } from "aws-amplify/api"

export async function deletePostFromDB(post: Post) {
  try {
    const client = generateClient()
    // Starting from the outside in, delete the post first in dynamoDB
    await client.graphql({
      query: deletePost,
      variables: {
        input: {
          id: post.id,
        },
      },
    })
   // delete all other media associated with this post
    const objects = await list({
      prefix: `${post.sharedMedia.id}/${post.id}`,
      options: {
        pageSize: 2,
      },
    })

    for (const obj of objects.items) {
     /*  THIS APPEARS TO BE WHERE THE ERROR IS THROWN */
      console.log("Removing post object:", obj.key, "from storage")
      await remove({ key: obj.key })
    }

    // Now that post is deleted, lets clean up sharedMedia if it is no
    // longer needed. Get the sharedMedia data to check if other post are present

    const queryInput: PostsBySharedMediaIdQueryVariables = {
      sharedMediaId: post.sharedMedia.id,
    }

    const postResponse = await client.graphql({
      query: postsBySharedMediaId,
      variables: queryInput,
    })
    // If other posts are using this sharedMedia, don't delete it
    // otherwise delete it
    if (postResponse.data.postsBySharedMediaId.items.length === 0) {
      console.log("found no other shared media's using this post")
      const objects = await list({
        prefix: `${post.sharedMedia.id}`,
        options: {
          pageSize: 4,
        },
      })
      // Delete each object
      for (const obj of objects.items) {
        console.log("Removing shared media object", obj.key, "from storage")
     /*  THIS APPEARS TO BE WHERE THE ERROR IS THROWN */
        await remove({ key: obj.key })
      }
      // console.log("looks like this was the only post using this shared media")

      // Now that the storage is cleared, lets delete the dynamo db sharedMedia
      const response = await client.graphql({
        query: deleteSharedMedia,
        variables: {
          input: {
            id: post.sharedMedia.id,
          },
        },
      })
    }
  } catch (error) {
    reportCrash({ error, method: "deletePostFromDB" })
  }
}

Log output

{
    "errorType": "AmplifyStorageError",
    "title": "NotImplemented",
    "message": "A header you provided implies functionality that is not implemented",
    "stack": "NotImplemented: A header you provided implies functionality that is not implemented\n    at construct (native)\n    at apply (native)\n    at _construct (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:32722:106)\n    at Wrapper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:32694:64)\n    at construct (native)\n    at _callSuper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:140177:170)\n    at AmplifyError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:140198:25)\n    at construct (native)\n    at _callSuper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:275605:170)\n    at StorageError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:275613:25)\n    at buildStorageServiceError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:280638:111)\n    at ?anon_0_ (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:281546:86)\n    at next (native)\n    at asyncGeneratorStep (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:6883:26)\n    at _next (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:6902:29)\n    at tryCallOne (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:258726:16)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:258807:27)\n    at apply (native)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40497:26)\n    at _callTimer (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40376:17)\n    at _callReactNativeMicrotasksPass (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40421:17)\n    at callReactNativeMicrotasks (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40627:44)\n    at __callReactNativeMicrotasks (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9560:48)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9333:45)\n    at __guard (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9532:15)\n    at flushedQueue (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9332:21)\n    at callFunctionReturnFlushedQueue (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9317:33)",
    "function": "deleteReelFeelFromDB"
}


aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_appsync_graphqlEndpoint": "https://5tvnvesrgjfjdclupp5rzrh5gi.appsync-api.us-east-1.amazonaws.com/graphql",
    "aws_appsync_region": "us-east-1",
    "aws_appsync_authenticationType": "API_KEY",
    "aws_appsync_apiKey": *REDACTED*,
    "aws_cognito_identity_pool_id": *REDACTED*,
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": *REDACTED*,
    "aws_user_pools_web_client_id": *REDACTED*,
    "oauth": {},
    "aws_cognito_username_attributes": [],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "GIVEN_NAME",
        "FAMILY_NAME",
        "BIRTHDATE",
        "PHONE_NUMBER"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": [
            "REQUIRES_LOWERCASE",
            "REQUIRES_UPPERCASE",
            "REQUIRES_NUMBERS",
            "REQUIRES_SYMBOLS"
        ]
    },
    "aws_cognito_verification_mechanisms": [
        "PHONE_NUMBER"
    ],
    "aws_user_files_s3_bucket": "reelfeelmedia",
    "aws_user_files_s3_bucket_region": "us-east-1"
};


export default awsmobile;

Manual configuration

Amplifyconfiguration.json

{
  "aws_project_region": "us-east-1",
  "aws_appsync_graphqlEndpoint": "https://5tvnvesrgjfjdclupp5rzrh5gi.appsync-api.us-east-1.amazonaws.com/graphql",
  "aws_appsync_region": "us-east-1",
  "aws_appsync_authenticationType": "API_KEY",
  "aws_appsync_apiKey": *REDACTED*,
  "aws_cognito_identity_pool_id": *REDACTED*,
  "aws_cognito_region": "us-east-1",
  "aws_user_pools_id": *REDACTED*,
  "aws_user_pools_web_client_id": *REDACTED*,
  "oauth": {},
  "aws_cognito_username_attributes": [],
  "aws_cognito_social_providers": [],
  "aws_cognito_signup_attributes": [
    "GIVEN_NAME",
    "FAMILY_NAME",
    "BIRTHDATE",
    "PHONE_NUMBER"
  ],
  "aws_cognito_mfa_configuration": "OFF",
  "aws_cognito_mfa_types": [],
  "aws_cognito_password_protection_settings": {
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": [
      "REQUIRES_LOWERCASE",
      "REQUIRES_UPPERCASE",
      "REQUIRES_NUMBERS",
      "REQUIRES_SYMBOLS"
    ]
  },
  "aws_cognito_verification_mechanisms": [
    "PHONE_NUMBER"
  ],
  "aws_user_files_s3_bucket": "reelfeelmedia",
  "aws_user_files_s3_bucket_region": "us-east-1"
}

Additional configuration

App entry extra:

import amplifyconfig from "./app/amplifyconfiguration.json"

const libraryOptions = {
  Storage: {
    S3: {
      prefixResolver: async ({
        accessLevel,
        targetIdentityId,
      }: {
        accessLevel: any
        targetIdentityId?: string
      }) => {
        if (accessLevel === "guest") {
          return "public/"
        } else if (accessLevel === "protected") {
          return `protected/${targetIdentityId}/`
        } else {
          return `private/${targetIdentityId}/`
        }
      },
    },
  },
}

Amplify.configure(amplifyconfig, libraryOptions)

Mobile Device

iPhone 12

Mobile Operating System

iOS 17.3

Mobile Browser

Safari

Mobile Browser Version

No response

Additional information and screenshots

No response

@ChristopherGabba ChristopherGabba added the pending-triage Issue is pending triage label Mar 17, 2024
@cwomack cwomack added Storage Related to Storage components/category React Native React Native related issue labels Mar 18, 2024
@cwomack cwomack self-assigned this Mar 18, 2024
@nadetastic nadetastic added the Gen 2 Issues related to Gen 2 Amplify projects label Mar 18, 2024
@cwomack
Copy link
Member

cwomack commented Mar 19, 2024

Hello @ChristopherGabba, and thank you for providing the sample code. Was there a specific page/section of the Storage docs you were following to set up your backend? And is this an app that you've explicitly only used Gen2 resources/docs for backend or was this something you're trying to migrate from a Gen 1 setup?

@ChristopherGabba
Copy link
Author

@cwomack @ashika112

I'll give you the step-by-step:

  1. I started building this app about 9 months ago, and at the time, all I saw was Amplify version 5. I used the online Amplify Console online (i.e. not the CLI) to do all the setup and then I just used the amplify pull command to bring it all into my app.
  2. I got the app mostly working but I would get these occasional Token Expired errors that drove me crazy for months Issue #12735 during media upload.
  3. After a bunch of troubleshooting, I figured what the heck, and I did the full upgrade to amplify v6 following the Docs.
  4. It was quite a conversion, and in the process I read about ways to improve my GraphQL queries to be more efficient using @index in the GraphQL structure. I ended up having to modify some relationships that the Amplify Console would not allow me to do, so I had to modify my schema.graphql file directly and then did an amplify push to update the backend. When I did this, it rendered the Amplify Console (API section) uneditable anymore because I provided a relationship that it did not understand/allow, but it works fine in the app. The relationship was basically having more than one @many-to-many's for one GraphQL object, which I needed but could not do in the Amplify Console.

That's how I ended up with my current structure.

Step #2 Is where I set up all of my configs. I still kind of have both a v5 and v6 amplifyconfiguration.json and aws-exports.js in my file system. The other big deal was the from v5 to v6, they no longer used public as the default storage category and it changed to guest, which I thought was strange. I tried to accommodate that with the Additional configurations referenced above (converting guest back to public).

@HuiSF
Copy link
Member

HuiSF commented Mar 21, 2024

they no longer used public as the default storage category and it changed to guest

You don't really need to override the prefix in your bucket for guest access level, the guest still uses public/ under the hood. (See here for details)

This NotImplemented (A header you provided implies functionality that is not implemented) is a service error (code: 501). For DeleteObject service call to S3, the library doesn't apply any headers, however. Can you check the object keys values you were removing which triggered this error, do they happen to have any special characters, or punctuations?

@ChristopherGabba
Copy link
Author

Hello @HuiSF, I just replicated the error with more logs on the the keys being deleted via remove:

    for (const obj of objects.items) {
      console.log("Deleting post key:", obj.key)
      await remove({ key: obj.key })
    }
      for (const obj of objects.items) {
        console.log("Deleting sharedMedia key:", obj.key)
        await remove({ key: obj.key })
      }

Output:

 LOG  Deleting post key: 83a71e87-4e5f-4fda-8c08-a8fc4f10719c/rf-cba41459-7eb4-41db-aca6-c26bec855acb/videoThumbnailUrl.jpg
 LOG  Deleting post key: 83a71e87-4e5f-4fda-8c08-a8fc4f10719c/rf-cba41459-7eb4-41db-aca6-c26bec855acb/videoUrl.mp4
 LOG  Deleting sharedMedia key: 83a71e87-4e5f-4fda-8c08-a8fc4f10719c/originalUrl.mp4
 LOG  Deleting sharedMedia key: 83a71e87-4e5f-4fda-8c08-a8fc4f10719c/thumbnailUrl.jpg
 ERROR  {
    "errorType": "AmplifyStorageError",
    "title": "NotImplemented",
    "message": "A header you provided implies functionality that is not implemented",
    "stack": "NotImplemented: A header you provided implies functionality that is not implemented\n    at construct (native)\n    at apply (native)\n    at _construct (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:32722:106)\n    at Wrapper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:32694:64)\n    at construct (native)\n    at _callSuper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:140177:170)\n    at AmplifyError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:140198:25)\n    at construct (native)\n    at _callSuper (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:275605:170)\n    at StorageError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:275613:25)\n    at buildStorageServiceError (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:280638:111)\n    at ?anon_0_ (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:281546:86)\n    at next (native)\n    at asyncGeneratorStep (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:6883:26)\n    at _next (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:6902:29)\n    at tryCallOne (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:258726:16)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:258807:27)\n    at apply (native)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40497:26)\n    at _callTimer (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40376:17)\n    at _callReactNativeMicrotasksPass (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40421:17)\n    at callReactNativeMicrotasks (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:40627:44)\n    at __callReactNativeMicrotasks (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9560:48)\n    at anonymous (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9333:45)\n    at __guard (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9532:15)\n    at flushedQueue (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9332:21)\n    at callFunctionReturnFlushedQueue (http://192.168.1.148:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app:9317:33)",
    "function": "deletePostFromDB"
}

I have not yet removed my prefix override yet, but will and try to replicate it again.

@HuiSF
Copy link
Member

HuiSF commented Mar 21, 2024

Thanks @ChristopherGabba the keys strings look normal to me (I found an instance that DeleteObject may encounter this error when the key contains quotes)

How do you replicate this error, in a local environment? If so, I think if you can inspect the outgoing network request (request URL and headers) for this remove operation that would be helpful.

@ChristopherGabba
Copy link
Author

@HuiSF I will try to do this and see what the headers are on the network request in the coming day or so. I should not have quotations in any object keys, but will confirm there is nothing weird going on.

@ChristopherGabba
Copy link
Author

ChristopherGabba commented Mar 21, 2024

@HuiSF Managed to catch the bug in dev tools network tab:

Here was the logs of the keys:

 LOG  Deleting post key: d51334e6-de2d-44f4-9186-8fe30aab9ee2/rf-dc627e34-3cb6-4bf2-a127-828f0294123c/reactionThumbnailUrl.jpg
 LOG  Deleting post key: d51334e6-de2d-44f4-9186-8fe30aab9ee2/rf-dc627e34-3cb6-4bf2-a127-828f0294123c/reactionVideoUrl.mp4
 LOG  Deleting sharedMedia key: d51334e6-de2d-44f4-9186-8fe30aab9ee2/originalUrl.mp4
 LOG  Deleting sharedMedia key: d51334e6-de2d-44f4-9186-8fe30aab9ee2/thumbnailUrl.jpg
 ERROR  {
    "errorType": "AmplifyStorageError",
    "title": "NotImplemented",
    "message": "A header you provided implies functionality that is not implemented",
    "stack": "NotImplemented: A header you provided implies functionality that is not implemented\n    at construct (native)\n    at apply ,
    "function": "deletePostFromDB"
}

Headers Tab:

Request URL: https://reelfeelmedia.s3.us-east-1.amazonaws.com/public/d51334e6-de2d-44f4-9186-8fe30aab9ee2/thumbnailUrl.jpg
Request Method: DELETE
Status Code: 501 
Connection: close
Content-Type: application/xml
Date: Thu, 21 Mar 2024 20:50:38 GMT
Server: AmazonS3
Transfer-Encoding: Identity
x-amz-id-2: Su+YNtrfDpVQQprfkYSZmXoDFUAHlzv/NGf7jIp8PJv+IIFfZJAKvkh2nVK6gEUQWXSdFHrXtsY=
x-amz-request-id: NMM2TMRNRXW767WB
Provisional headers are shown
Learn more
Authorization: AWS4-HMAC-SHA256 Credential=ASIAWNCHDFQHQHY2PSOK/20240321/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=71fc075b2bee0f422312049eb0038c234fbec334ce0c132ee1e0efeec13e88ec
baggage: sentry-environment=development,sentry-public_key=3b5232832eaa5d236bd2769b99a42d31,sentry-release=com.g10developers.reelfeel%401.7.2%2B1,sentry-trace_id=709534f5ca104c86806419f4c256cefd
sentry-trace: 709534f5ca104c86806419f4c256cefd-3f432b4e21cc43f1-0
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20240321T205037Z
x-amz-security-token: IQoJb3JpZ2luX2VjEB0aCXVzLWVhc3QtMSJIMEYCIQDOlVHoUkjyyJhufAn9gwien0WvjkYR+2iXUM3K/BxPKwIhAKZn+Depf+pFzBra9xQT1QRg1DxxoIKt0Ij7ha6nYk+OKsQECDYQABoMNDQwMzgzMjUzNTE5IgxE/eDLnn2xM+ojUg0qoQQWFQUIF/1MJxSSZXynzMgslwAv60ax+MD+UXbewqLbfcZv7ASI9vlkuCGGRoOruq7SbNFL5HJwdOVBMKI/1BLghyfBXBy04bO8jHdsUA+3erU9H1DhUrMVc6vl5rB41nLaDFc5GkafBUEL+zonnmn997NgV1flUOKw3+eYmYAxfXm2GMr1NJO1600yvFgZCLLS/NPV1BTlDXb/8s7BSXSnwQBITitFvbfX+L5opaAzxxUxxSzm+Lg+IyyawjmlQ15X3itoG+fX89eg7DLOcpRwi8GY0sOpYpyY+ktCdgGuqfSt3JjEr4xpYj+HR1hlzyvYz5rSX7tiYZwNBOMg58ASkKNYTxapttgs1jhpsORPzHXv1C8g8N9U7zCZlLpGNJhucI1WMubIrF9wqHakwXt+k+SDYbjiTFRUjloCWPwAiz+xLnuLTSntHvJIr7hwXjhorPqUEZ5GNxOFtbnzkKF44KvDD3m0BcBAqdRzgo4IVgmaNuLkug+7I6i5fQ6cVBxbjCA/Kxl3uAR6S5tyLnyht9CQFmRyUrUy2BtpBWUXHsq54TiMIZbiqTKItOrn6qCZdTBZZY7lBlX7DGH0bL5upNSTHewsLIXSEJGhssLDd8TpdZi3ZFw+HQaeV5sXLgPZHbilJmGIhabQuCOzzzf4geHEopipIuhdiTWaWiunGJ8nEXe93KM7jdcboQKFKF+YkpBIitY7GWQ8hz/UDgYwbjDwufKvBjqEAgJXEkg3wy/i/DnbGJkzgg9j6DzGxZNxgQc6TdDbbGWWCe6uM+W5GNvXk42AhXnb4v+TFk9ZXtc2TGXrJJRHK9+F5wXxwofD2O45n07ZNkaqy262AMGIZr0dSw7f6iPMsQgbcq4lu4BsFNiTgUne/Qs7ayvg89dGWrxOs+iXjqFm12WjIPrvSzc0xQStskhXBeWA6KBfK8EMzdL6GhEbaWtFj7hTlPNS/gc5KLMxpZ0cem6vCE/adoG7XeCBg17BpQIyxm3pt5TBKrMbz+sDI3EErlIFPVVya5T22FIU9NLtpFpP6/2PnWamzKgaeN0aH0Em+rWpZ6S4H5NNO21nvRQEyEIM
x-amz-user-a

Preview Tab:

<Error
>
<Code
>
NotImplemented
</Code
>
<Message
>
A header you provided implies functionality that is not implemented
</Message
>
<Header
>
If-Modified-Since
</Header
>
<RequestId
>
NMM2TMRNRXW767WB
</RequestId
>
<HostId
>
Su+YNtrfDpVQQprfkYSZmXoDFUAHlzv/NGf7jIp8PJv+IIFfZJAKvkh2nVK6gEUQWXSdFHrXtsY=
</HostId
>
</Error>

Response Tab:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>If-Modified-Since</Header><RequestId>NMM2TMRNRXW767WB</RequestId><HostId>Su+YNtrfDpVQQprfkYSZmXoDFUAHlzv/NGf7jIp8PJv+IIFfZJAKvkh2nVK6gEUQWXSdFHrXtsY=</HostId></Error>

Screenshot of Window:

Screenshot 2024-03-21 at 3 53 23 PM

Note: This happened after about 10 delete attempts, so it's about 1/10. Note this also occured after removing the extra configurations regarding the guest to public conversion.

For comparison if needed expand the below to see the successful deletion response headers immediately before this one failed:

Headers Tab:

Request URL: https://reelfeelmedia.s3.us-east-1.amazonaws.com/public/d51334e6-de2d-44f4-9186-8fe30aab9ee2/originalUrl.mp4
Request Method: DELETE
Status Code: 204 
Date: Thu, 21 Mar 2024 20:50:38 GMT
Server: AmazonS3
x-amz-id-2: +ZlHPIR0f9VCtTfJPJhHJ0O/8qKLP7qDa8+rQPOVlJXuQDSPpD9bwdiLhsdr1WFBtclXVrSwCmI=
x-amz-request-id: 1GMB6E9ZNF50F3PD
Provisional headers are shown
Learn more
Authorization: AWS4-HMAC-SHA256 Credential=ASIAWNCHDFQHQHY2PSOK/20240321/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=34fc5c9f8ef50babd0ff9e84b13838be833e3d89200d7753b79499e5c540fabf
baggage: sentry-environment=development,sentry-public_key=3b5232832eaa5d236bd2769b99a42d31,sentry-release=com.g10developers.reelfeel%401.7.2%2B1,sentry-trace_id=709534f5ca104c86806419f4c256cefd
sentry-trace: 709534f5ca104c86806419f4c256cefd-3f432b4e21cc43f1-0
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20240321T205037Z
x-amz-security-token: IQoJb3JpZ2luX2VjEB0aCXVzLWVhc3QtMSJIMEYCIQDOlVHoUkjyyJhufAn9gwien0WvjkYR+2iXUM3K/BxPKwIhAKZn+Depf+pFzBra9xQT1QRg1DxxoIKt0Ij7ha6nYk+OKsQECDYQABoMNDQwMzgzMjUzNTE5IgxE/eDLnn2xM+ojUg0qoQQWFQUIF/1MJxSSZXynzMgslwAv60ax+MD+UXbewqLbfcZv7ASI9vlkuCGGRoOruq7SbNFL5HJwdOVBMKI/1BLghyfBXBy04bO8jHdsUA+3erU9H1DhUrMVc6vl5rB41nLaDFc5GkafBUEL+zonnmn997NgV1flUOKw3+eYmYAxfXm2GMr1NJO1600yvFgZCLLS/NPV1BTlDXb/8s7BSXSnwQBITitFvbfX+L5opaAzxxUxxSzm+Lg+IyyawjmlQ15X3itoG+fX89eg7DLOcpRwi8GY0sOpYpyY+ktCdgGuqfSt3JjEr4xpYj+HR1hlzyvYz5rSX7tiYZwNBOMg58ASkKNYTxapttgs1jhpsORPzHXv1C8g8N9U7zCZlLpGNJhucI1WMubIrF9wqHakwXt+k+SDYbjiTFRUjloCWPwAiz+xLnuLTSntHvJIr7hwXjhorPqUEZ5GNxOFtbnzkKF44KvDD3m0BcBAqdRzgo4IVgmaNuLkug+7I6i5fQ6cVBxbjCA/Kxl3uAR6S5tyLnyht9CQFmRyUrUy2BtpBWUXHsq54TiMIZbiqTKItOrn6qCZdTBZZY7lBlX7DGH0bL5upNSTHewsLIXSEJGhssLDd8TpdZi3ZFw+HQaeV5sXLgPZHbilJmGIhabQuCOzzzf4geHEopipIuhdiTWaWiunGJ8nEXe93KM7jdcboQKFKF+YkpBIitY7GWQ8hz/UDgYwbjDwufKvBjqEAgJXEkg3wy/i/DnbGJkzgg9j6DzGxZNxgQc6TdDbbGWWCe6uM+W5GNvXk42AhXnb4v+TFk9ZXtc2TGXrJJRHK9+F5wXxwofD2O45n07ZNkaqy262AMGIZr0dSw7f6iPMsQgbcq4lu4BsFNiTgUne/Qs7ayvg89dGWrxOs+iXjqFm12WjIPrvSzc0xQStskhXBeWA6KBfK8EMzdL6GhEbaWtFj7hTlPNS/gc5KLMxpZ0cem6vCE/adoG7XeCBg17BpQIyxm3pt5TBKrMbz+sDI3EErlIFPVVya5T22FIU9NLtpFpP6/2PnWamzKgaeN0aH0Em+rWpZ6S4H5NNO21nvRQEyEIM
x-amz-user-agent: aws-amplify/6.0.20 storage/5 framework/202

Screenshot of Successful deletion immediately before:

Screenshot 2024-03-21 at 4 04 01 PM

@HuiSF
Copy link
Member

HuiSF commented Mar 21, 2024

Thanks @ChristopherGabba this is helpful. In the service responded error message, it mentioned about this header If-Modified-Since that caused this error. though I don't see it in your screenshot, can you double if the screenshot shows every header fields that attached to the request? Specially look for If-Modified-Since.

In addition, the Amplify library doesn't not attach this header any where. I noticed that sentry-trace presents in the request header, I just make sure there is no other parties in your app manipulating the request headers.

@ChristopherGabba
Copy link
Author

@HuiSF I just double-checked. The only place I see If-Modified-Since is on the Preview Tab (all headers are shown in the screenshot):

Screenshot 2024-03-21 at 4 34 32 PM

And I counted 7 displayed ^

Screenshot 2024-03-21 at 4 33 02 PM

I do have sentry installed in my application, but if that was the cause, wouldn't it block every post DELETE request to the server? This all started occurring in the last few weeks. I did upgrade from sentry-expo to sentry-react-native in that timespan maybe, it's hard to recall, I've done a lot in the last few weeks.

@HuiSF
Copy link
Member

HuiSF commented Mar 22, 2024

@ChristopherGabba Thanks for confirming, this is odd, as the request doesn't have that header but the service complained about it... I don't have a clue now how this could happen at this moment. We do have integration tests performing similar amount of remove objects calls and it has not encountered this error so far.

Could you check and try to disable any functionality that alters network request and run some tests see if it still reproducible? If it's still reproducible, could you create a minimum sample app for reproducing this issue and share with us?

@ChristopherGabba
Copy link
Author

@HuiSF I disabled sentry in my app by removing all the sentry code and replicated the error. Here are the new logs and screenshot

Request URL: https://reelfeelmedia.s3.us-east-1.amazonaws.com/public/3dfdbe5d-0ee6-409a-adb2-ca413b41debe/thumbnailUrl.jpg
Request Method: DELETE
Status Code: 501 
Connection: close
Content-Type: application/xml
Date: Mon, 25 Mar 2024 23:10:02 GMT
Server: AmazonS3
Transfer-Encoding: Identity
x-amz-id-2: GBP19d6y72Gz7L2lqZWtv0NHB0XgUNw4iuRQi+46fOKi4BsSP+rYbbwdvGwVTuZm+wczx1wsOxo=
x-amz-request-id: WT9PF89AEVNQF1WS
Provisional headers are shown
Learn more
Authorization: AWS4-HMAC-SHA256 Credential=ASIAWNCHDFQH7N25LJU5/20240325/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token;x-amz-user-agent, Signature=4365ad2c059e4b8f3c4496099b2acb904784f081db8469b1bcc3f52859818f98
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20240325T231002Z
x-amz-security-token: IQoJb3JpZ2luX2VjEID//////////wEaCXVzLWVhc3QtMSJHMEUCICsBt+iC0WRPdV1SXs5LXQ7dDu+MuqVDmNb0IouHZYnmAiEAw2aEx4fuj6CjSRaIhZzFOQKOtBiM3htTR3Lgv1EhHS4qzQQImP//////////ARAAGgw0NDAzODMyNTM1MTkiDJkNn4k59zTZroYntiqhBL4JAyb/e6dsCBHAuKFltw+KCJsyz/fbroc4TmmdVaVFM8TL5zHRmEDEdKjX4LRnCqK6OPel/vnMO09xjb8LdYa9d6j/YW4dAa/IhMmtcON7akpVsPFcld2V0ULQQDr7FtMjknCxmtoqUJe121l6GTuKkoUUDSpenIZKf6x1LDQtWF5OcblulbWl29wgHOuKgQS1jFa4gCdx77anWVihGmg2rZJ4OdUMtQ4MQdhktzX1mPvv8s3RR3wQdVFeNd8bfLAXVXZU/NSB3OsdYFdXDpOiqOlVAyGTvncphfu/K7hQ0/GSFIs3W8OET/d7a4ufWIwklDgcc8jFvG2tEb2WThfl4riRg/BcbBTvrFD06h9Xjmr1YDdoTgC/tF9mH3jZelZM/Pn83ZHU7pm9PxzMCwGkS6aCXj6N1DShfpbC1guJC6z5TJ9qYJTs+c7rDQPUXlCfiwUFtn8eFo9D+4cpYoKl8uNoDun5H1+9q1LWR8oxW/OogXL4bCyLGlDgsIK9Ni8COCCqcxGmTFaGYFJXR4yv2XIGk5XO61xT8PMguDxUPulB5GHh59G3vwVuErcOscYZqkD2eyyrgtnej8aGaO0w90sfL9JSoqKC/T0+jiYUMr24O3sBKXB71iqIXvoaBqlU/96CSYjh2Ji1ZOQwNLWoBhufXmsLZPicF+oKVoBd00rPOLvJzlSqtT542Fc1OaCBXhrUk2u0aBDJw0p4S4xXMIqIiLAGOoUCUJA7467FzTIDGszm0jts+HEJrAdAbpwvkEXQRcLAsxhl9Cqj70vj3yMmGoYM60hrb8oLQDBwEpza4Et//fJP+CWut2IInIZ0OaE6vcWQus2Eso8I+BJqmCHTxAVsU9eMEE+0W9yt359p1MgmljqWISqR5+mhXf1A07DHQLRFOTGryR6d3uyxqDU1nzSCVbbekVPBvdGwbY3xhRKe5SumvtGOr7ZOL4b77GUcxm1GMR7l9xY2SvvGKv+W6hEtBiz03MZA+d5LPLCfZKUEDsPZNS6+YSyiRDLMzD8SbXWj9UTXafaLKZSihQV/OKUZ2j9pYL43vZMreDVVJ3aSWnOj4Xl57Pxq
x-amz-user-agent: aws-amplify/6.0.20 storage/5 framework/202

Preview Tab

<Error>
<Code>
NotImplemented
</Code>
<Message>
A header you provided implies functionality that is not implemented
</Message>
<Header>
If-Modified-Since
</Header>
<RequestId
>
WT9PF89AEVNQF1WS
</RequestId>
<HostId>
GBP19d6y72Gz7L2lqZWtv0NHB0XgUNw4iuRQi+46fOKi4BsSP+rYbbwdvGwVTuZm+wczx1wsOxo=
</HostId>
</Error>

html

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>If-Modified-Since</Header><RequestId>WT9PF89AEVNQF1WS</RequestId><HostId>GBP19d6y72Gz7L2lqZWtv0NHB0XgUNw4iuRQi+46fOKi4BsSP+rYbbwdvGwVTuZm+wczx1wsOxo=</HostId></Error>

Screenshot of network tab:
Screenshot 2024-03-25 at 6 14 14 PM

@ChristopherGabba
Copy link
Author

ChristopherGabba commented Mar 25, 2024

Sorry I accidentally hit "Close with comment" the issue is not resolved.

Here is the file that is still in the bucket, so it clearly did not get deleted:

Screenshot 2024-03-25 at 6 17 29 PM Screenshot 2024-03-25 at 6 18 05 PM

I will try to make a minimum reproducible example, but it could take quite a while. I'll have to set up another amplify app with auth, etc. Do you guys have a demo/example app I could start with?

@cwomack
Copy link
Member

cwomack commented Mar 27, 2024

@ChristopherGabba, let us know if you get a sample repro app up and running. I'll check with the team internally to see if we have one that can be used to duplicate this as well.

@cwomack
Copy link
Member

cwomack commented Mar 27, 2024

@ChristopherGabba, just wanted to add that the A header you provided implies functionality that is not implemented error that you're seeing seems to be coming from the S3 Service. That error isn't in our code base for v6.

@cwomack cwomack added the not-reproducible Not able to reproduce the issue label Mar 27, 2024
@ChristopherGabba
Copy link
Author

@cwomack Just want to clarify, are you suggesting that I submit an issue with the S3 team?

@ashika112
Copy link
Member

@ChristopherGabba, iterating this error is not thrown from Amplify. It is on the actual call to S3 delete object.

This NotImplemented (A header you provided implies functionality that is not implemented) is a service error (code: 501). For DeleteObject service call to S3, the library doesn't apply any headers

Since the library is not modifying this header. I could be happening from any of your dependency. We can try and help but at this we would need minimal repo code to see whats going on.

@SuperSuccessTalent
Copy link

Hi @ChristopherGabba. I am facing exactly the same issue.
Updating V5 to V6 resolved the "Token expired" issue properly?
You said you still sometimes get ECONNABORTED error on V6.

@ChristopherGabba
Copy link
Author

@ashika112 I will try to get a minimum reproducible example going for several of my errors in the coming weeks.

@ChristopherGabba
Copy link
Author

ChristopherGabba commented Apr 16, 2024

@ashika112 @HuiSF I made a demo app but so far am unable to replicate the error. I'll keep trying in that app and try to replicate exactly what I'm doing in my main app.

In the meantime, I'm now getting this error almost every time I send a remove command to S3. What are the chances I could get on a quick teams or zoom call with you to troubleshoot this? I am able to easily replicate it on my primary app. Is there another way I could try to get this solved? I'm open to anything. Is there a way for you to check to see what the server is actually seeing vs what my Chrome Debugger is showing?

Edit:
I found a few threads that mention this NotImplemented Error, although these are all in the PUT request:

All of these seem to reference an issue where the Content-Length header is 0. I'm not seeing header or value anywhere in Chrome Debugger. I'm going to try to capture this Delete Object request using a different debugger and see if more headers are exposed to see.

Edit: Captured all the headers on the Reactotron Debugger:
Screenshot 2024-04-18 at 11 56 00 AM
Screenshot 2024-04-18 at 11 56 09 AM
Screenshot 2024-04-18 at 11 56 22 AM

I do not see any other data included in the Request Headers that wasn't showing up in the chrome debugger.

@ChristopherGabba
Copy link
Author

ChristopherGabba commented May 5, 2024

@ashika112 @HuiSF I just captured this Header NotImplemented bug in sentry and got the following:

Screenshot 2024-05-05 at 2 52 01 PM

What is interesting is that Sentry captured the following bug simultaneously:

Screenshot 2024-05-05 at 2 56 38 PM

Basically I'm watching a video. When the video ends, I send a DELETE to the server. I'm wondering if this error is related to the video still being connected to the server or something and then deleting it while connected.

@ChristopherGabba
Copy link
Author

Okay I am getting the bug regardless of whether or not the video is playing. I read through this stack overflow thread: https://stackoverflow.com/questions/7670156/amazon-s3-getting-501-error-on-put and it seems to hint at a content-length header being set to 0 or empty?

I also read in the same thread:
image

I'm trying to use Charles Proxy but struggling with it, I will keep trying.

@ChristopherGabba
Copy link
Author

ChristopherGabba commented May 6, 2024

Update: I was able to capture the request with Charles Proxy and the content-length field is zero. However, I am seeing this on every single request made and some work and some don.t I tried the delete request again and it was successful.

Unsuccessful request:

Screenshot 2024-05-06 at 8 07 44 AM

Successful Request:
Screenshot 2024-05-06 at 8 08 24 AM

Notice that the headers on the unsuccessful request include If-Modified-Since and also include If-None-Match. I'm literally getting this not implemented header 50% of the time now and I'm not doing anything out of the ordinary.

I also noticed that the list function call returns a Last Modified Header and an eTag:
Screenshot 2024-05-06 at 11 24 13 AM

@ChristopherGabba
Copy link
Author

@HuiSF @ashika112 @chrisbonifacio

I invited you to a private repo and updated the ReadMe with instructions to reproduce the issue.

@ashika112
Copy link
Member

@ChristopherGabba Thanks for the reproducible code. Will try to pull in and see whats happening. Can you also provide link to the repo?

@ChristopherGabba
Copy link
Author

ChristopherGabba commented May 23, 2024

Here you go:

https://github.com/ChristopherGabba/ReelFeelApp

I've updated the ReadMe again, so please refer to it. I've made two accounts for troubleshooting and sent the same content for testing for the error.

@ChristopherGabba
Copy link
Author

Good morning @chrisbonifacio / @HuiSF / @ashika112, hope all is well. If you guys need help reproducing the issue, or any other details, let me know and I can gladly get on the phone to discuss.

@chrisbonifacio
Copy link
Member

Hey, @ChristopherGabba. Please reach out to me on Discord with your availability and email to invite. I'll schedule a call for tomorrow if that's okay.

@chrisbonifacio
Copy link
Member

@ChristopherGabba as per our call, the cause of this issue seems to stem from some nested dependency or deeper network layer of Expo or React Native. Going to close this issue and ask that anyone else running into this please track the issues opened on the Expo and React Native repos regarding the headers mentioned in this thread.

I hope those teams are able to help out and you're unblocked soon 🙏
Of course, we're happy to re-open this issue if it turns out the root cause stems from our library.

@marcmoo
Copy link

marcmoo commented Aug 31, 2024

In my case, I got the error message when the path includes '-' in the folder name, and when I got the '-' removed, it is working fine
for eg. my user.id is '1223-2342-123412356341'
and the file i uploaded to path was 'public/1223-2342-123412356341/avatar.jpg'
deleting from the same path give this error
but when I got the '-' all removed, remove method never complains again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gen 2 Issues related to Gen 2 Amplify projects not-reproducible Not able to reproduce the issue pending-triage Issue is pending triage React Native React Native related issue Storage Related to Storage components/category
Projects
None yet
Development

No branches or pull requests

8 participants