awsmobile pull/push fails with cryptic error
dan1elhughes opened this issue · 8 comments
> awsmobile pull
retrieving the latest backend awsmobile project information
awsmobile project's details logged at:
awsmobilejs/#current-backend-info/backend-details.json
awsmobile project's specifications logged at:
awsmobilejs/#current-backend-info/mobile-hub-project.yml
awsmobile project's access information logged at:
awsmobilejs/#current-backend-info/aws-exports.js
awsmobile project's access information copied to:
src/aws-exports.js
contents in #current-backend-info/ is synchronized with the latest in the aws cloud
? sync corresponding contents in backend/ with #current-backend-info/ Yes
(node:8281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'lastPushSuccessful' of undefined
at Object.syncToDevBackend (/home/ddhughes/.npm-global/lib/node_modules/awsmobile-cli/lib/backend-operations/ops-appsync.js:139:21)
at /home/ddhughes/.npm-global/lib/node_modules/awsmobile-cli/lib/backend-operations/backend-info-manager.js:180:24
at Array.forEach (<anonymous>)
at syncAllToDev (/home/ddhughes/.npm-global/lib/node_modules/awsmobile-cli/lib/backend-operations/backend-info-manager.js:178:25)
at /home/ddhughes/.npm-global/lib/node_modules/awsmobile-cli/lib/backend-operations/backend-info-manager.js:161:21
(node:8281) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8281) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm not entirely sure what this error means or how to go about resolving it, I get the same error when I try to push or deploy
> node --version; npm --version; awsmobile --version
v10.5.0
6.1.0
1.1.4
it means, you don't have catch!
var promise = dynamodb.get(getItemParams).promise();
promise.then(function(data) {
})
.catch(function(err) {
console.log('ERROR: ' + JSON.stringify(err));
});
Don't forget to catch.
This one: TypeError: Cannot read property 'lastPushSuccessful'
somone else will have to give you the answer to that one. This variable doesn't appear in any of my project files.
try deleting the #current-backend-info folder and do a 'awsmobile pull' again.
@jbarwick Yup, I'm familiar with .then
/.catch
, but it's in the CLI so there's nowhere to add the catch unless I go digging around in the source.. Which may take me some time to wrap my head around. 😄
OK I've made some progress, I've found that deleting the /awsmobilejs/backend/appsync
directory allows me to successfully awsmobile pull
.
However that's not much use as I assume if I run a awsmobile publish
now, it'll delete all my appsync work. I can see from version control that before awsmobile pull
I have around 350 lines in awsmobilejs/backend/appsync/schema.graphql
, but after the pull I have 65 lines which appear to be a default schema set. It also deletes all my resolver mappings.
The contents inside the folder awsmobilejs/.awsmobile/info
is probably manually modified, that's why the cli is complaining because it sees the appsync
folder inside awsmobilejs/backend
, but it can not find any information about the appsync feature, which is stored in the file awsmobilejs/.awsmobile/info/appsync-info.json
If you could, please tell us the steps that lead to this error, like how appsync is added to the project, what's been edited, and push/pull operations you have done prio to this error. etc. It'd greatly help us to understand issue and investigate further.
Has there been an update on AWS side on how the CLI communicates? I'm now seeing a flag "lastPushSuccessful": false
in awsmobilejs/.awsmobile/info/appsync-info.json
, and I'm able to deploy successfully. I don't think I changed anything, other than doing yet another git reset and awsmobile pull. The immediate problem is resolved, but I don't actually know how I resolved it - what does that flag indicate? What adds it to the project, and how come it wasn't being added before?
I'm also getting the following keys deleted from my aws-exports.js
when I pull, but I don't think that's new (shall I open a new issue for this?) :
aws_appsync_graphqlEndpoint: '...',
aws_appsync_region: '...',
aws_appsync_authenticationType: '...',
The appsync feature is not in the aws mobile hub services, it's an experimental add-on in the awsmobile cli, it's not a complete feature.
If you do not use appsync, you should remove everything related to it by executing 'awsmobile features` and de-select the appsync feature.
close this issue for now, feel free to re-open it or open another one if you see other problems.