amplify-js: Uncaught (in promise) Api does not exist
So I’m trying to use API gateway to put data to the table in the database. I’m using vue.js and whenever I run this function I get an error: Uncaught (in promise) API scenariosCRUD does not exist even if API name is certainly correct.
Here’s my function: post: async function () {
console.log('adding data to database');
const response = await API.post('scenariosCRUD', '/scenarios', {
body: {
ScenarioId: 1,
ScenarioName: 'test',
Graph: {},
UserId: 1234,
ConfigurationId: 1234,
},
});
alert(JSON.stringify(response));
}
`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 30 (4 by maintainers)
Hey i know its been a long time, but i got this issue recently and managed to solve it by importing the aws-export.js file: import awsConfig from ‘./aws-export.js’ and then API.configure(awsConfig). Hope it still helps 😃
If you look into your
aws-exports.js, do you see your API with the very same key (scenariosCRUD)?This is definitely a workaround but not a solution. I’d like to request this issue be re-opened. I am using aws-amplify 3.3.23, and my code only works by
Otherwise I get an error saying
api <api-name> does not existI had the same issue surface on a project I had been working for a few months now which had no previous issues with the API.
I was previously configuring Amplify as follows:
This setup was working for me for about 6 months, until a few days the error in this issue resurfaced.
I have used @IsaacTrevino 's solution, but that’s not covering the AppSync API, I’m still getting errors on that API.
@haverchuck Please re-open this issue so that it can be addressed