awsmobile-cli
awsmobile-cli copied to clipboard
Issue while trying to configure the database
Everything was working fine until I tried to delete the only table in my project.
Find below the error trace:
$ awsmobile database configure
(node:43624) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at createTableJsonStructure (/usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations/scripts/database-ops.js:809:19)
at /usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations/scripts/database-ops.js:924:38
at new Promise (<anonymous>)
at main (/usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations/scripts/database-ops.js:915:10)
at /usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations/scripts/database-ops.js:979:5
at new Promise (<anonymous>)
at Object.exports.specify (/usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations/scripts/database-ops.js:978:10)
at Object.specify (/usr/local/lib/node_modules/awsmobile-cli/lib/backend-operations/ops-database.js:31:27)
at Object.configureFeature (/usr/local/lib/node_modules/awsmobile-cli/lib/backend-operations/backend-spec-manager.js:174:24)
(node:43624) 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: 2)
(node:43624) [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.
Same error trace is coming to me also while configuring database in hello-world app as given in the aws documentation.
What if i delete "feature-operation" folder from (/usr/local/lib/node_modules/awsmobile-cli/lib/feature-operations) and redo the database configure process from start.
My issue resolved. I again made a new project and followed each step in aws documentation as it is starting from awsmobile init command and it worked this time there was no error.
I concluded that if there is no breakage during the database setup process. This error doesn't occur.
hi,
Me too facing same issue, i am actually new to awsmobile hub and had multiple times deleted table , created table, created index and pushed it after some time it started giving me the error.
Thanks
My workaround,
run awsmobile features
the disable database
run awsmobile features again
enable database
then try to run awsmobile configure database
See below console output
`AWSProject Tushar$ awsmobile database configure
(node:15349) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (
macbook-pro:AWSProject Tushar$ awsmobile features
? select features: user-signin, user-files, analytics, hosting Warning: local contents for the feature will be removed if you disable it ? please confirm to disable: database Yes disabled: database backend awsmobile project enabled features: analytics, hosting, user-files, user-signin
macbook-pro:AWSProject Tushar$ awsmobile features
? select features: user-signin, user-files, database, analytics, hosting enabled: database backend awsmobile project enabled features: analytics, database, hosting, user-files, user-signin
macbook-pro:AWSProject Tushar$ awsmobile database configure
? Select from one of the choices below. (Use arrow keys) ❯ Create a new table Remove table from the project Edit table from the project
macbook-pro:AWSProject Tushar$ `
hope it helps someone