Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UnhandledPromiseRejectionWarning when trying to start Fitbit shell in command line

Hi,

i started working on my first fitbit watchface yesterday. Everything went well yesterday. I strictly followed the instructions (https://dev.fitbit.com/getting-started/) and was able to create a first watchface and also view it via "fitbit$ bi" in the Fitbit OS simulator. Unfortunately I didn't finish yesterday and wanted to continue working this morning. but as soon as i would start the Fitbit shell with "npx fitbit" command. However, in the command line, all I get is this error message:

 

(node:4712) UnhandledPromiseRejectionWarning: Error: Fetch of https://api.fitbit.com/1/user/-/profile.json returned status 401 Unauthorized
at C:\Users\info\fitbit-langweilo\node_modules\@fitbit\sdk-cli\lib\api\baseAPI.js:20:37
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.userProfile [as default] (C:\Users\info\fitbit-langweilo\node_modules\@fitbit\sdk-cli\lib\api\userProfile.js:17:22)
at async main (C:\Users\info\fitbit-langweilo\node_modules\@fitbit\sdk-cli\lib\cli.js:52:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4712) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:4712) [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 reinstalled Node.js, nvm and
Switch to Node.js Version 14. I also reinstalled Fitbit OS simulator. no change.

I also created a new project "npx create-fitbit-app my-first-clock", as soon as I enter "npx fitbit" I keep getting the same error.

what can I do?

Best Answer
0 Votes
1 REPLY 1

I'd guess at an authentication issue. "npx fitbit" tries to use your default web browser to establish a connection with your fitbit dev account. Sometimes it doesn't succeed because something is down. Sometimes manually logging out of your Fitbit account from the browser, and logging in again, can help. I've also heard that browser caching can be an issue.

Peter McLennan
Gondwana Software
Best Answer