akhilerm / youtube-music-alexa-skill

Alexa skill to play songs from youtube music on echo devices
Apache License 2.0
74 stars 28 forks source link

unable to run "ask deploy" #1

Closed sixtusk closed 7 months ago

sixtusk commented 1 year ago

Runing ask deploy leads to a "Required parameter(s) missing in the request." error.

here is some debug log:

[2023-03-12T20:20:57.954Z] - DEBUG - UPLOAD-SKILL-PACKAGE
PUT https://skill-uploads-prod-na.s3.amazonaws.com/amzn1.ask-package.upload.85f4bb8b-ef61-481e-a08f-abf950db14ea?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230312T202056Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIA426DM2YL3VBIJQ6D%2F20230312%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=81af33fb04a06fddcfe5fc74ebb636c10f1c722c10b907b7dac58189abe1913b
status code: 200 OK

Request headers: {"User-Agent":"ask-cli/2.28.0 Node/v16.13.1 Windows_NT/10.0.19045","content-length":55625}

Request body: [object Object]

Response headers: {"x-amz-id-2":"+gx4+dpJt2t7wO+gLcAepfbrjFgXhIpYR3vAEZKNyCgjB+bz7jOlaLqTYiGqy95HisulwFHNLeI=","x-amz-request-id":"VJC3D3BA0S6Q8Y7H","date":"Sun, 12 Mar 2023 20:20:58 GMT","x-amz-expiration":"expiry-date=\"Mon, 20 Mar 2023 00:00:00 GMT\", rule-id=\"Clean up old uploads\"","x-amz-server-side-encryption":"aws:kms","x-amz-server-side-encryption-aws-kms-key-id":"arn:aws:kms:us-east-1:882488694295:key/7ce99451-cb86-4401-a69a-cf380132d654","etag":"\"0e89eff9f4aa40f954e0e3121c4486f6\"","server":"AmazonS3","content-length":"0","connection":"close"}
----------------------------------------
[2023-03-12T20:20:58.167Z] - DEBUG - IMPORT-PACKAGE
request-id: eb9b820f-99be-4496-a8e3-b6b2381f5bb0
POST https://api.amazonalexa.com/v1/skills/imports
status code: 400 Bad Request

Request headers: {"authorization":"Atza|IwEBINbONTX5jlEOnLfm8FJfpSqyUUzsNcpjDGSEqc6Ec6OUPC2mYPk6sC-vfWP08PQdqZnjx-cN6-MDANWhDxiyk2ftWhGHrKHSWmEYR7zesr7xvJTf52m-B9lVF_cXSWjhtghGl257fwvtm8xETUu8HElVo9GQT4UxowDUnv-l2sfd4lNwaUhjgZ-i64gx5mkoR4_7uaAtRPHg-0DSIUh2TlKbPp5Bvbft_DSeK28j2wylCMfWdpJwhabUif2FVJBCF6-WmIX7nZ9tC_NC6roRz04JDbilFtaLX0pRV2CVvdvRJrffdSo4JOqnfdaJ-MNnUJ20B8wub8p0hGMgEyLgSj74sSdLnUTidQbms-43Mv5ldnNFivi-UjbhCJywUuJbiQzBSaRo9Ju7Bxr7vHGl61q6KFOLQC0vXU_HefsqGB9Q8Yc3NNeb6tG1YpNGXYSkSh7CLoD0mGToo_ACsUHXMm9ilzWk8evLap-_cGI9NCnaYPOJYjId3N2TBsZZhMPnE5BwliI8zLHJWF1ZBshu-qIFsfaaecy-jX2cvC4-0ZGsaGmsQfa13E895KK06zOXaXXvKSjNmXrw7YBKJaF9InQaCC2jsblxFYY1Bd2lG1J8fZZ-aPy8bnSxcciAO-KEx2hJxG3WBQe8RynpOSjwIWmk","User-Agent":"ask-cli/2.28.0 Node/v16.13.1 Windows_NT/10.0.19045","accept":"application/json","content-type":"application/json","content-length":390}

Request body: {"location":"https://skill-uploads-prod-na.s3.amazonaws.com/amzn1.ask-package.upload.85f4bb8b-ef61-481e-a08f-abf950db14ea?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230312T202056Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIA426DM2YL3VBIJQ6D%2F20230312%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=81af33fb04a06fddcfe5fc74ebb636c10f1c722c10b907b7dac58189abe1913b"}

Response headers: {"content-type":"application/json","content-length":"59","connection":"close","server":"Server","date":"Sun, 12 Mar 2023 20:20:58 GMT","x-amz-rid":"0SQS1ZSN199XVPKYV8FT","x-amzn-requestid":"eb9b820f-99be-4496-a8e3-b6b2381f5bb0","x-amz-date":"Sun, 12 Mar 2023 20:20:58 GMT","vary":"Content-Type,Accept-Encoding,User-Agent","strict-transport-security":"max-age=47474747; includeSubDomains; preload","x-cache":"Error from cloudfront","via":"1.1 3588568928e677ce9bb8aedfd6e0ea04.cloudfront.net (CloudFront)","x-amz-cf-pop":"TXL50-P2","x-amz-cf-id":"TQ2eN0cyQmJt0SMox4O7_kyVyaaopSuE6CaWjuYyMjfUcJOjpzdqXQ=="}

Response body: {"message":"Required parameter(s) missing in the request."}
ORi0N commented 1 year ago

Did you get this working in the end?

As I'm not an advanced AWS developer I already have trouble understanding the setup instructions. I have aws cli, nodejs and ask installed, cannot run ask deploy however.

akhilerm commented 1 year ago

I will take a look at the error. I am still running this on my Echo Dot 4.

@ORi0N Can you say which part of the setup instructions are unclear so that I can modify/fix them

Kewz4 commented 1 year ago

I'm having the same error: "[Error]: CliError: The lambda deploy failed for Alexa region "default": InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x) while creating or updating functions."

Part 4 and 5 of the instructions are unclear, im not an advanced developer and it is unclear to me what to do after deploying.

Thanks in advance, looking forward to this!

akhilerm commented 1 year ago

I think the code requires some change related to node version. Will update the node version , rebuild and then push the changes.

Kewz4 commented 1 year ago

Yeah I also thought of that, thank you, let us know when the changes have been pushed and also if you could be a but more detailed on what to do after deploying that would be awesome since I'm not nich of a code development savy.

Kewz4 commented 1 year ago

Yeah, it was the node version, I changed it in the ask-resources.json and i was able to deploy it fine. I generated my Youtube API, but I really have no clue on what to do next, or where do I put this API.

Kewz4 commented 1 year ago

Alright I figured it out, however when it is running on my echo dot, and I say play (song) it just says, you just triggered playSongIntent, and checking the JSON for the intents there's no handlers for the intent so I don't know if this is a problem on my end.

ORi0N commented 1 year ago

Thanks, Changed in ask-resources.json to 18.x and now it works:

"skillInfrastructure": { "userConfig": { "runtime": "nodejs18.x",

and now ask deploy returns: `Code for region default built to /home/xxx/aws/youtube-music-alexa-skill-main/.ask/lambda/build.zip successfully with build flow NodeJsNpmBuildFlow.

==================== Deploy Skill Infrastructure ==================== ✔ Deploy Alexa skill infrastructure for region "default"

The api endpoints of skill.json have been updated from the skill infrastructure deploy results.

Skill infrastructures deployed successfully through @ask-cli/lambda-deployer.

==================== Enable Skill ==================== The skill has been enabled.`

What's next ?

ORi0N commented 1 year ago

And where do you add the YOUTUBE API KEY?

Here?

image

Kewz4 commented 1 year ago

That's where I added it, did you manually input the key name? Or was it already there? I am talking about "YOUTUBE_API_KEY"

ORi0N commented 1 year ago

I had to manually add it, was nothing there.

You anu further? I am afraid we’ll need the dev for answers.

On Sun, 18 Jun 2023 at 18:35, Kewz4 @.***> wrote:

That's where I added it, did you manually input the key name? Or was it already there? I am talking about "YOUTUBE_API_KEY"

— Reply to this email directly, view it on GitHub https://github.com/akhilerm/youtube-music-alexa-skill/issues/1#issuecomment-1596199212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLFXL47JMQYLXKRPJWYRTXL4U4XANCNFSM6AAAAAAVYKMUVQ . You are receiving this because you were mentioned.Message ID: @.***>

Kewz4 commented 1 year ago

Yes, I went further, go into the Amazon developer console > Alexa Skill Set and you can see the skill set there and do any changes and build.

Then you go into your Alexa app > skills > scroll down into custom skills > developer and it should be there.

However the skill doesn't do anything when I ask it to play music, it recognizes the invitation command but that's it.

We can also talk on discord if you want, my username is just kewz. (with a period)

ORi0N commented 1 year ago

Here it just says 'I have trouble doing what you asked' on whatever I ask it.

Kewz4 commented 1 year ago

Try saying launch the "invitation name" skill.

ORi0N commented 1 year ago

Well, it's not that it's not launching. That works. It's also activated successfully: image

And the skill is Lambda is triggered successfully too . Check in the CloudWatch logs here: image

When troubleshooting, the error message in the return message from the googleapis.com led me to the fact that the Youtube API v3 was not enabled in the project. I could easily do this using: https://console.cloud.google.com/apis/dashboard?project=yourprojectname. It's just clicking enable.

On the phone, Alexa answers me what it will play, but it remains silent afterwards. And it throws this error in the logs: 2023-06-23T11:58:21.855Z 0a331ae9-34bd-4717-b696-50c38b7eb8dc INFO ~~~~ Error handled: AskSdk.GenericRequestDispatcher Error: Unable to find a suitable request handler. at createAskSdkError (/var/task/node_modules/ask-sdk-runtime/dist/util/AskSdkUtils.js:23:19) at GenericRequestDispatcher.dispatchRequest (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:72:55) at async GenericRequestDispatcher.dispatch (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:45:22) at async CustomSkill.invoke (/var/task/node_modules/ask-sdk-core/dist/skill/CustomSkill.js:68:26)

But when actually testing from the Echo Dot v2 it works fine!!! It's correctly playing the song.

Alexa, Open youtube

Play Mark Knopfler, what it is

Playing ....

Hope this helps you @Kewz4 !

ORi0N commented 1 year ago

I've forked and submitted the changes we made to get it working @akhilerm . Thanks again for the dev.

ORi0N commented 1 year ago

It's however not playing all content. Some songs work fine, others do not, and when inspecting the logs:

Working song: 2023-06-23T15:36:24.093Z 57899906-6ec6-4221-b9ee-0134fe4095fe INFO { mimeType: 'audio/webm; codecs="opus"', qualityLabel: null, bitrate: 142160, audioBitrate: 160, itag: 251, initRange: { start: '0', end: '265' }, indexRange: { start: '266', end: '653' }, lastModified: '1685999978500351', contentLength: '3778546', quality: 'tiny', projectionType: 'RECTANGULAR', averageBitrate: 134598, audioQuality: 'AUDIO_QUALITY_MEDIUM', approxDurationMs: '224581', audioSampleRate: '48000', audioChannels: 2, loudnessDb: 0.10999966, url: 'https://rr3---sn-p5qlsny6.googlevideo.com/videoplayback?expire=1687556182&ei=9ruVZODOM4zn8wSxyLioDA&ip=44.200.48.216&id=o-AOCNvmfn6xttLzecQpYm1dVWM-3tWGojlKqpo-UMnt7o&itag=251&source=youtube&requiressl=yes&mh=Gm&mm=31%2C29&mn=sn-p5qlsny6%2Csn-p5qddn7d&ms=au%2Crdu&mv=m&mvi=3&pl=11&initcwndbps=1035000&spc=qEK7B411jiKmyBtoFhGOasuJCdr_9uM3pAlgSApuuw&vprv=1&svpuc=1&mime=audio%2Fwebm&ns=8Nc7rU8j8bJhnwqhimXpcOYN&gir=yes&clen=3778546&dur=224.581&lmt=1685999978500351&mt=1687534149&fvip=5&keepalive=yes&fexp=24007246&c=WEB&txp=4432434&n=LMtgWyE3ZWOQ8A&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgS2vCF-IgpSbYwcr8G68NOtHzCTbWRmA1eBwd27DKIBQCIQDFSMoX2OuGn_77ZCNrimBX57DdA_3C6r-9Ay6gPr8AnQ%3D%3D&sig=AOq0QJ8wRQIgKeu7_k0y9HAe73G2t4eV6q6rvvfnDaNGUZn4GyQSFXACIQC725c1F-Jfd4mLvl9RHeBieDjjOIbzyGwR7ryKA9uIVg%3D%3D', hasVideo: false, hasAudio: true, container: 'webm', codecs: 'opus', videoCodec: null, audioCodec: 'opus', isLive: false, isHLS: false, isDashMPD: false }

Not working song: 2023-06-23T15:50:35.789Z 6c9f11dd-43f1-4deb-9fab-b52a5f632a61 INFO { mimeType: 'video/mp4; codecs="avc1.64001F, mp4a.40.2"', qualityLabel: '720p', bitrate: 377577, audioBitrate: 192, itag: 22, width: 1280, height: 720, lastModified: '1681982993805470', quality: 'hd720', fps: 25, projectionType: 'RECTANGULAR', audioQuality: 'AUDIO_QUALITY_MEDIUM', approxDurationMs: '8179948', audioSampleRate: '44100', audioChannels: 2, url: 'https://rr2---sn-p5qlsnrr.googlevideo.com/videoplayback?expire=1687557034&ei=Sr-VZL6tMIOb8wS4w7bgBg&ip=44.200.63.182&id=o-ADI-w4YWsJaTU9uzoCh1m_C6vkajhDfq91J3qcbSIARN&itag=22&source=youtube&requiressl=yes&mh=um&mm=31%2C29&mn=sn-p5qlsnrr%2Csn-p5qddn7r&ms=au%2Crdu&mv=m&mvi=2&pl=11&gcr=us&initcwndbps=818750&spc=qEK7B3p563lfMOctz79L3vqx9QP3P1KntcqhvChGQg&vprv=1&svpuc=1&mime=video%2Fmp4&ns=I1qqQAbCMDfD0g-Cx7xD3skN&cnr=14&ratebypass=yes&dur=8179.948&lmt=1681982993805470&mt=1687535107&fvip=3&fexp=24007246&c=WEB&txp=4532434&n=8vCvglpSBvnHLg&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgOjfaoNrPyjeMzhgzr0beoue0nDG9Z9yqPtQTAFxkqqoCIQCL6afcMXbhykVd8kMU31hd_0SYavZfmmQE0dT8ILxWpw%3D%3D&sig=AOq0QJ8wRQIgSCBFsqf2lou_VWnkfJwjoA7jipTe7i52UVqzAgvsJnwCIQDXrLk70lIgaeuiKMA0NLwxnkuRWxWfogj4d11ubNe6Mw%3D%3D', hasVideo: true, hasAudio: true, container: 'mp4', codecs: 'avc1.64001F, mp4a.40.2', videoCodec: 'avc1.64001F', audioCodec: 'mp4a.40.2', isLive: false, isHLS: false, isDashMPD: false }

It seems that the URL returned is not correct? When trying to access it using browser, the first one works, but I get a 403 on the second one. Permission denied, why?

akhilerm commented 1 year ago

@ORi0N @Kewz4 I have migrated the skill to an Alexa hosted skill instead of self hosted for easier development and monitoring. This makes sure that many of the details are hidden from user and it is easier to deploy. I still have to add a migration step for existing users, but new users can easily use the new alexa hosted skill.

It would be great if you can look at the current doc and check if I am missing something.

Also, regarding some songs not working. @ORi0N can you list the exact query used. I have raised an issue with ask sdk, https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/723, but havent got any traction so far.

Thanks for trying out this

ORi0N commented 1 year ago

The exact command used is "Open youtube" + "Play Avicii you make me"

Query:

2023-08-27T19:08:07.408Z INFO { kind: 'youtube#searchResult', etag: 'm1U7P4FmX0SmtMReYv4ntpUCRVA', id: { kind: 'youtube#video', videoId: '2GADx4Hy-Gg' }, snippet: { publishedAt: '2013-09-16T13:00:35Z', channelId: 'UC1SqP7_RfOC9Jf9L_GRHANg', title: 'Avicii - You Make Me (Official)', description: "Listen to Avicii's latest single “SOS” here: https://Avicii.lnk.to/SOS.", thumbnails: { default: [Object], medium: [Object], high: [Object] }, channelTitle: 'AviciiOfficialVEVO', liveBroadcastContent: 'none', publishTime: '2013-09-16T13:00:35Z' }, videoId: '2GADx4Hy-Gg' }

Leads to: mimeType: 'audio/webm; codecs="opus"', qualityLabel: null, bitrate: 144812, audioBitrate: 160, itag: 251, initRange: { start: '0', end: '265' }, indexRange: { start: '266', end: '670' }, lastModified: '1574706181940362', contentLength: '3711890', quality: 'tiny', projectionType: 'RECTANGULAR', averageBitrate: 128761, audioQuality: 'AUDIO_QUALITY_MEDIUM', approxDurationMs: '230621', audioSampleRate: '48000', audioChannels: 2, loudnessDb: 5.0132666, url: 'https://rr2---sn-p5qs7nsk.googlevideo.com/videoplayback?expire=1693184887&ei=F5_rZL7WG4rh8wT_nLGIBA&ip=54.226.20.136&id=o-AATvH8Nt1tm6GzMLokn3G4IdY0WNP-o7xLEBOs6RRQfb&itag=251&source=youtube&requiressl=yes&mh=MD&mm=31%2C26&mn=sn-p5qs7nsk%2Csn-ab5sznzr&ms=au%2Conr&mv=u&mvi=2&pl=22&gcr=us&spc=UWF9f6g1KcWZWSM38X6zgyTHKSGgnXGPrYJxvI2U8w&vprv=1&svpuc=1&mime=audio%2Fwebm&ns=4X367NPDZBvzApl60agIw7EP&gir=yes&clen=3711890&dur=230.621&lmt=1574706181940362&mt=1693162768&fvip=5&keepalive=yes&fexp=24007246%2C51000011&beids=24472436&c=WEB&txp=5531432&n=C4ppJD_zbnlXXw&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRQIhAPQBQ_rUFXqdS8OW2V25fYgm_FLSpBFWo5vsw_QxU27rAiAhtwKQIcoYVEXzJS4j7aa_vVZmcbhXfP479tuRgodySA%3D%3D&sig=AOq0QJ8wRQIgOgR7PeQpiSxxjlrtUI48zeR6BKEHcSRCiMUmVGc74moCIQDLPI5P-i2SM7kVIjIhW4UB5DG6BJRbvWAU0TsUDEj2JA%3D%3D', hasVideo: false, hasAudio: true, container: 'webm', codecs: 'opus', videoCodec: null, audioCodec: 'opus', isLive: false, isHLS: false, isDashMPD: false

That doesn't play

akhilerm commented 1 year ago

Just reproduced this issue on my Echo Dot 4. Did some digging around, but TBH I am not able to understand why its not playing this music.

ORi0N commented 1 year ago

Really a lot of songs/streams are impacted by this issue. It's barely usable now sadly. What can we do to get more traction on this issue?

akhilerm commented 7 months ago

Can this issue be closed, and we can create another issue for some songs not playing?

ORi0N commented 7 months ago

Yes it can. There is indeed still the problem of certain songs not playing which almost renders the skills useless today ;)

I have opened a new issue for this, so this one can be closed. I'm willing to try some more things if needed.

akhilerm commented 7 months ago

Issue with some songs not playing is discussed here. https://github.com/akhilerm/youtube-music-alexa-skill/issues/6