alexa / ask-toolkit-for-vscode

ASK Toolkit is an extension for Visual Studio Code (VSC) that that makes it easier for developers to develop and deploy Alexa Skills.
https://developer.amazon.com/en-US/docs/alexa/ask-toolkit/get-started-with-the-ask-toolkit-for-visual-studio-code.html
Apache License 2.0
109 stars 53 forks source link

GitHub repository problem using alexa in visual studio code #213

Closed aleor99 closed 1 year ago

aleor99 commented 2 years ago

Desktop (please complete the following information):

Question

aleor99 commented 2 years ago

Hi, i've an issue using alexa on Visual studio code. I'm not so expert, actually a neophyte in this field, but i can't ope a skill in vs code in any way. I can see correctely the skill in my amazon profile but once i try to import or create one vs send me a message saying "https://git-codecommit.us-east-1.amazonaws/v1/repos/1b3a3c38-8a1-474e-9259-bfea6aeb3eaf (Press "enter" to confirm...). What do i have to do ?

jallwork commented 2 years ago

I've had a similar problem for a month now. It's not only VS code, (ask new or ask clone fails asking for git credentials in PS or terminal)

It's the same as issues 54 and 59 - https://github.com/alexa/ask-toolkit-for-vscode/issues/59 but none of those solutions work for me

I found this but it doesn't help: https://github.com/alexa/ask-toolkit-for-vscode#faqs

Here's the error message: Skill clone failed. Reason: Git folder setup failed for c:\Users\john\Documents\Alexa\BUG\noavg\noavg. Reason: Failed to execute git { "exitCode": 128, "gitErrorCode": "AuthenticationFailed", "gitCommand": "fetch", "stdout": "", "stderr": "warning: invalid credential line: Failed to fetch a LWA access token.\nfatal: Authentication failed for 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/5d485.. }

this is the process:

ask new Please follow the wizard to start your Alexa skill project -> ? Choose the programming language you will use to code your skill: Python ? Choose a method to host your skill's backend resources: Alexa-hosted skills Host your skill code by Alexa (free). ? Choose the default region for your skill: us-east-1 ? Please type in your skill name: hello world skill ? Please type in your folder name for the skill project (alphanumeric): helloworldskill

Project directory for hello world skill created at
C:\Users\john\Documents\Alexa\bug\helloworldskill

CliError: Error: Command failed: git fetch --all --quiet warning: invalid credential line: Failed to fetch a LWA access token. fatal: Authentication failed for 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/a31ee2dc-82f3-49f2-b0e4-d25a689e3a49/'

at GitClient._execCommands (C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\clients\git-client.js:221:15)
at GitClient.fetchAll (C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\clients\git-client.js:81:10)

hosted-skill-controller\clone-flow.js:89:13) trollers\hosted-skill-controller\clone-flow.js:62:3) at C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\controllers\hosted-skill-controller\index.js:68:17 ller\index.js:104:7 at C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\clients\smapi-client\index.js:169:11 s\smapi-client\index.js:189:3) at C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\clients\smapi-client\index.js:168:9 at Request._callback (C:\Users\john\AppData\Roaming\npm\node_modules\ask-cli\lib\clients\http-client.js:64:12)

Node.js v18.12.1

Versions are: OS: Windows_NT x64 10.0.19045 Visual Studio Code Version: 1.73.1 Alexa Skills Toolkit Version: 2.12.1 Git Version: git version 2.38.1.windows.1 npm: '8.19.2', node: '18.12.1', ask: 2.28.0

git-credential-helper file has "${configFile}"

ask util git-credentials-helper fails too: The uri provided is not valid. (https://api.amazonalexa.com/v1/skills//alexaHosted - should the extra slash be there?)

Here's the logs:

ask util git-credentials-helper --debug [Error]: [Fatal]: Failed to parse SMAPI's response. Please run again with --debug to check more details. Error: SyntaxError: Unexpected token < in JSON at position 0

-------------------- Debug Mode -------------------- [2022-11-23T13:06:52.249Z] - DEBUG - GET-ALEXA-HOSTED-SKILL request-id: b3ee205e-c147-40df-933b-a8a4ee38813d GET https://api.amazonalexa.com/v1/skills//alexaHosted status code: 400 Bad Request

Request headers: {"authorization":"Atza|IwEBI.........Wg","User-Agent":"ask-cli/2.28.0 Node/v18.12.1 Windows_NT/10.0.19045"}

Response headers: {"content-length":"97","connection":"close","server":"Server","date":"Wed, 23 Nov 2022 13:06:49 GMT","x-amz-rid":"K3AKZJXCXPX76XY4Y6B1","x-amzn-requestid":"b3ee205e-c147-40df-933b-a8a4ee38813d","x-amz-date":"Wed, 23 Nov 2022 13:06:49 GMT","vary":"Content-Type,Accept-Encoding,User-Agent","strict-transport-security":"max-age=300; includeSubDomains; preload","x-cache":"Error from cloudfront","via":"1.1 1de7ecec44e546a1e71d662ee3f2ba42.cloudfront.net (CloudFront)","x-amz-cf-pop":"LHR3-C2","x-amz-cf-id":"pY2DcIev304H8KOrrjxK5rTTVD4eAq0_WZEcZaesYWrJTNGBo_pOLA=="}

Response body: "\n The uri provided is not valid.\n\n"

Can someone please help?

jallwork commented 2 years ago

The ask util git-credentials-helper --debug may be a red herring. It runs if in the new skill's folder

ask new

cd skill folder ask util git-credentials-helper --debug works and provides a username and password, but they aren't accepted if I run ask init, e.g: ask init --hosted-skill-id amzn1.ask.skill.SKILLID (obtained from developer console)

jallwork commented 1 year ago

My problem was caused by AVG. Turning off Fire Shield solves the problem. The skill is downloaded without problem. I don't like doing that but haven't found another way round it yet. It's caused by the line of code : token=$(curl -f -s -d grant_type=refresh_token -d client_id="${clientID}" -d client_secret="${clientSecret}" -d refresh_token="${refreshToken}" \ "${lwaAPI}"/auth/O2/token)

in git-credential-helper

jallwork commented 1 year ago

In the end, I had to completely uninstall AVG (not just disable it) (Avast had the same problem too), so if you have a problem, try that.

aleor99 commented 1 year ago

In the end, I had to completely uninstall AVG (not just disable it) (Avast had the same problem too), so if you have a problem, try that.

Thank you

github-actions[bot] commented 1 year ago

This issue is stale since it has been open for 60 days with no activity. Please respond or this issue will be closed soon.

github-actions[bot] commented 1 year ago

This stale issue has been closed now. Please reopen the issue if you are still having problems with the toolkit.