Skip to content
Advertisement

Uncaught (in promise) API does not exist

I’m trying to add existing backend to a new react frontend. Every time I call the API from react i get, Uncaught (in promise) API api3ceaf69c does not exist

Client side code

JavaScript

index.js

JavaScript

aws-exports.json

JavaScript

“aws-amplify”: “^4.3.27”

Error Error screenshot

I went through multiple answers around the same issue but none of them are working for me.

Interestingly this exact same code was working a few days back until I had to rebuild my backend due to some changes.

Advertisement

Answer

I figured out the problem finally! Issue was at the place where I’m calling Amplify.configure(aws_exports). For some reason aws exports was not getting initialized in index.js file so I moved it closer to where I am actually calling the api, i.e. getData() function. It started working post that.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement