amplify-js: NotImplemented: A header you provided implies functionality that is not implemented - AWS Amplify Storage remove()
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
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
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 19 (8 by maintainers)
@ChristopherGabba, iterating this error is not thrown from Amplify. It is on the actual call to S3 delete object.
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.
@HuiSF I just double-checked. The only place I see
If-Modified-Sinceis on the Preview Tab (all headers are shown in the screenshot):And I counted 7 displayed ^
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-expotosentry-react-nativein that timespan maybe, it’s hard to recall, I’ve done a lot in the last few weeks.@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.