Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade skill to work with v2 #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

btoconnor
Copy link
Contributor

Issue #, if available: #19

Description of changes:

The code was doing an in-line filter for timers with the active attribute. With v2, there is no attribute, and all timers returned are considered active. Thus, the loop was filtering all timers and always returning an empty set.

Additionally - it looks like nodev12 has been officially removed from support on the Alexa pipeline. I updated the code to use v16 - though the current recommendation is v18. It took me a while to figure out how to even get the codebase off of 12 so I only went to 16, but it's probably a good idea to bump this to 18 sooner than later.

I also took the liberty of fixing 2 minor QOL issues - feedings now parse a float (so you can say 7.5 or whatever). Additionally. one of my last commits created an issue with moment (have I mentioned I hate moment?). This fixes that issue when recording sleep / tummy time.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cdubz
Copy link
Member

cdubz commented Aug 8, 2023

Hmmm trying to review here but having trouble. I haven't deployed the skill in a while so attempting to start fresh and getting the following on ask deploy (after other setup):

➜  babybuddy-alexa-skill git:(btoconnor.upgrade_to_bb_v2) ask deploy
Deploy configuration loaded from ask-resources.json
Deploy project for profile [default]

==================== Deploy Skill Metadata ====================
Uploading the entire skill package and building the models. Normally it takes a few minutes...
  ✔ Received a new skill id: amzn1.ask.skill.49536132-5f24-4647-ab84-0acc07058659
  ✔ Importing skill using import id: amzn1.ask-package.import.29d86791-42c6-475e-abff-91d452fe6a0b
  ✖ [Interaction Model] build has failed.
    → [Interaction Model] build has failed.
[Warn]: [object Object]
[Warn]: [Interaction Model] build has failed.
[Error]: {
  "skill": {
    "resources": [
      {
        "action": "CREATE",
        "errors": [
          {
            "message": "The trigger setting for the Lambda arn:aws:lambda:us-west-2:927530314501:function:ask-BabyBuddy-default-skillStac-AlexaSkillFunction-ELP8QROXA110 is invalid."
          }
        ],
        "name": "Manifest",
        "status": "FAILED"
      }
    ],
    "skillId": "amzn1.ask.skill.49536132-5f24-4647-ab84-0acc07058659"
  },
  "status": "FAILED",
  "warnings": [
    {
      "message": "The imported package contains 1 number of file(s) at invalid or access listed paths. Such files, under the following directories, were not processed: [skill.json.example]"
    }
  ]
}

Not sure how to troubleshoot either of those things. Any thoughts?

@btoconnor
Copy link
Contributor Author

Oh - yes. That happened to me too. You need to move the skill.json.example file out of that directory. I ended up moving it out of the project altogether, but not sure if there's a better place to put it. Assuming moving that out fixes the problem and allows you to deploy to test the changes in the skill itself, I can do a little investigation to see if I can move it elsewhere and update the setup script.

@btoconnor
Copy link
Contributor Author

wrt to the first error, I saw that too. I'm not entirely sure the exact steps to get around this issue, but I spent a full day trying to solve it and ultimately I ended up deleting everything and re-deploying from scratch. I'm not convinced that was actually necessary. Some ideas rather than a full rebuild:

  • It might be wise to confirm you're on nodev16 rather than nodev12 - that one took me a really long time to figure out how to get around.
  • Update your version of ask-cli. Technically this isn't listed as a dependency in the project (for reasons I haven't quite figured out yet, maybe worthy of an investigation later). The later versions of ask-cli were able to give me better error messages, but that ultimately wound up with me replacing nodev12 with nodev16. It's possible both a newer ask-cli is needed along with nodev16. I'm currently on version 2.30.4

@cdubz
Copy link
Member

cdubz commented Aug 8, 2023

Yeah initially I had an older, global version of ask and the error message was slightly different. I got rid of that so the node16 one is used but that is the error I get now.

I'm on the same versions 🤔

➜  babybuddy-alexa-skill git:(btoconnor.upgrade_to_bb_v2) ✗ node --version
v16.20.1
➜  babybuddy-alexa-skill git:(btoconnor.upgrade_to_bb_v2) ✗ ask --version
2.30.4

Will keep poking around...

@cdubz
Copy link
Member

cdubz commented Aug 8, 2023

Ok got it sorted. My skill.json file had an old, deleted project ref stuck in there.

@cdubz
Copy link
Member

cdubz commented Aug 8, 2023

One step closer but still not there 😭

Not a terribly useful error message here...

➜  babybuddy-alexa-skill git:(btoconnor.upgrade_to_bb_v2) ✗ ask deploy
Deploy configuration loaded from ask-resources.json
Deploy project for profile [default]

==================== Deploy Skill Metadata ====================
Uploading the entire skill package and building the models. Normally it takes a few minutes...
  ✔ Received a new skill id: amzn1.ask.skill.6b5529ba-97d4-41e6-9d79-337726346c30
  ✔ Importing skill using import id: amzn1.ask-package.import.570984e3-5671-4627-8fc4-872f681f57c5
  ✔ [Interaction Model] build is complete.
[Warn]: [object Object]
Skill package deployed and all models built successfully.
Skill ID: amzn1.ask.skill.6b5529ba-97d4-41e6-9d79-337726346c30

==================== Build Skill Code ====================
yarn run v1.22.19
$ yarn clean && yarn compile && yarn build-final
$ rimraf .build build.zip ../../.ask/lambda/custom
$ tsc --build tsconfig.json --pretty
$ cpy package.json .build && cpy yarn.lock .build && cpy .env .build && cd .build/ && yarn install --production=true
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 4.03s.
yarn run v1.22.19
$ cd .build && bestzip ../build.zip * .env
Writing node_modules, package.json, src, yarn.lock, .env to ../build.zip...
zipped!
Done in 1.71s.
yarn run v1.22.19
$ cpy build.zip ../../.ask/lambda/custom/.build
Done in 0.23s.
Skill code built successfully.
Code for region default built to /home/chris/WebstormProjects/babybuddy-alexa-skill/.ask/lambda/custom/.build/build.zip successfully with build flow CustomBuildFlow.

==================== Deploy Skill Infrastructure ====================
  ✖ Deploy Alexa skill infrastructure for region "default"
    → The CloudFormation deploy failed for Alexa region "default": UnknownError
[Error]: {
  "message": "The CloudFormation deploy failed for Alexa region \"default\": UnknownError",
  "stack": "CliError: The CloudFormation deploy failed for Alexa region \"default\": UnknownError\n    at /home/chris/.nvm/versions/node/v16.20.1/lib/node_modules/ask-cli/dist/lib/view/multi-tasks-view.js:129:24\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
  "detail": {
    "name": "CliError"
  }
}

🤷

Also checked in the CloudFormation console and there is no other info there.

@btoconnor
Copy link
Contributor Author

Yeah - I went down this rabbit hole also. I did a lot of looking into the CloudFormation stuff and ultimately I concluded it was a red herring. You might need to redo ask configure ?

@cdubz
Copy link
Member

cdubz commented Aug 8, 2023

Hm no luck re-configuring. I'll have to hack at this some more later... I initially did this on a different computer and I wonder if that has some magic state I am missing here.

@btoconnor
Copy link
Contributor Author

That's what happened to me :( I was trying to re-create the environment on a new development machine.

It might be quicker to go through and delete the skill and lambda functions out of AWS and just try and do a fresh install - at least that's what I did in the end. I'd love to have some steps here that didn't require a full redeploy - but I'm not convinced those changes are tied to the v2 updates. Annoying, but ultimately I don't think the alexa skill has such a high adoption that it matters, and since the skill doesn't really manage any state on its own (it just talks to the django app) it's not ultimately a huge deal to destroy the skill and recreate it until there's a better understanding of what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants