"Invalid request token" while uploading image to server (ABI36_0_0RCTErrorDomain)

I’m no longer experiencing an error when selecting an image after building with 39.0.3.

I updated expo to version 39.0.3, react native to https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz also, and still having an error, this is my code:

const openGallery = async () => { const { granted } = await Permissions.askAsync(Permissions.CAMERA_ROLL) if (granted) { let data = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.Images, allowsEditing: true, aspect: [1, 1], quality: 0.5, })

        `const uriParts = data.uri.split('.')
        const fileType = uriParts[uriParts.length - 1]

        const image = {
            uri: data.uri,
            name: `photo.${fileType}`,
            type: `image/${fileType}`
        }

        const fd = new FormData()

        fd.append('image', {
            name: `photo.${fileType}`,
            type: `image/${fileType}`,
            uri: data.uri = Platform.OS === 'ios' ? data.uri.replace('file://', '') : data.uri
        })

        await updateUserAvatar(fd)
    } else {
        Alert.alert('You need to grant access to your camera roll')
    }
}`

updateUserAvatar(fd) should make the put request to my node backend, but I’m getting the error:

It only happens with formData (the only way I have of sending the image to a specific endpoint).

update your expo client to the latest version - expo client:install:ios and download the latest one from the app store. it should say 2.17.4 in the projects tab.

2 Likes

Same here, waiting for a fix. :sob:

I have solved my issue by reading https://github.com/facebook/react-native/issues/29364. In my case, the issue happened only on standalone ios app. But before that, you may check if the picture you try to upload is over the size limit of the API server and keep prompting code 413. I lower the quality of picture to 0.1 when using launchCameraAsync to meet the size limit requirement.

Guys! I solved it a few days ago. Had to upgrade almost everything, and it worked! Remember also to upgrade expo on the simulator / device

This issue should be fixed in React Native: v0.63.3… But will there a new Expo release soon including this fix in SDK39 as well ?

What good will it do ? Currently the error is only in the standalone app, not when it’s executed via the Expo Client?

you need to build a new version of the standalone app.

@tknuts - we cherry-picked the 0.63.3 fix. more info SDK 39++ bug fix release · Issue #10464 · expo/expo · GitHub

Thanks… rebuilding the app with 39.0.3 and deploying it to AppStore, did the trick :slight_smile: