question

bkvchu avatar image
bkvchu asked

Ask CLI clone results in token does not exist

When executing the clone command on my mac, with "node --version" of v8.9.1, I'm running into the following exception:

ask clone --skill-id < my alexa skill>

The property "token" does not exist.
/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:19
      if ('expires_at' in this.token) {
                      ^
TypeError: Cannot use 'in' operator to search for 'expires_at' in undefined
    at new AccessToken (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:19:24)
    at Object.createAccessToken [as create] (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:74:12)
    at isTokenExpired (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:72:35)
    at Object.tokenRefreshAndRead (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:59:10)
    at Object.module.exports.requestWithUrl (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:37:18)
    at Object.module.exports.request (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:23:20)
    at Object.callGetSkill (/usr/local/lib/node_modules/ask-cli/lib/api/api-wrapper.js:112:20)
    at Object.getSkill (/usr/local/lib/node_modules/ask-cli/lib/clone/clone-skill.js:12:20)
    at singleSkillCloneProcess (/usr/local/lib/node_modules/ask-cli/lib/clone/clone.js:49:16)
    at Command.handle (/usr/local/lib/node_modules/ask-cli/lib/clone/clone.js:42:17)<br>

I've tried running the command with quotes around the skill id and without quotes.

I have created an IAM user and ~/.aws/credentials file following the tutorial: https://developer.amazon.com/docs/smapi/set-up-credentials-for-an-amazon-web-services-account.html. I even removed the ARN resource restrictions from the suggested IAM policy since there were no warnings, but I'm still stuck....

alexa skills kitask cli
1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I'm running into the same issue. Were you able to get you skill status (ask api get-skill-status -s skilid) or is it jus the clone command thats causing this error ?

Here's the error I get:

	The property "token" does not exist.
	/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:19
	if ('expires_at' in this.token) {
	^
	TypeError: Cannot use 'in' operator to search for 'expires_at' in undefined
	at new AccessToken (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:19:24)
	at Object.createAccessToken [as create] (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:74:12)
	at isTokenExpired (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:72:35)
	at Object.tokenRefreshAndRead (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:59:10)
	at Object.module.exports.requestWithUrl (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:37:18)
	at Object.module.exports.request (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:23:20)
	at Object.callGetSkillStatus (/usr/local/lib/node_modules/ask-cli/lib/api/api-wrapper.js:154:20)
	at Command.handle (/usr/local/lib/node_modules/ask-cli/lib/api/skill.js:209:20)
	at Command.listener (/usr/local/lib/node_modules/ask-cli/node_modules/commander/index.js:315:8)
	at emitTwo (events.js:126:13)
0 Likes 0 ·
ssz avatar image
ssz answered

I came across the same issue, had to downgrade simple-oauth2 to 1.5.0

https://forums.developer.amazon.com/idea/117695/ask-cli-broken-by-simple-oauth2-dependency-update.html

Temp fix:

change version in /usr/local/lib/node_modules/ask-cli/package.json from '^1.0.2' to '1.5.0'

then from the terminal in the directory run

npm update
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bkvchu avatar image
bkvchu answered

Thanks for the answer ssz. I'm currently focusing on getting my local development environment setup first. I hope the issue gets solved soon so I don't have to self manage dependencies.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.