Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 10 17:39
    dependabot[bot] labeled #137
  • Aug 10 17:39
    dependabot[bot] opened #137
  • Aug 10 17:39

    dependabot[bot] on npm_and_yarn

    Bump path-parse from 1.0.5 to 1… (compare)

  • Jun 10 16:37
    btburton42 commented #115
  • Jun 07 21:51
    jkelvie commented #115
  • May 09 23:41
    dependabot[bot] labeled #136
  • May 09 23:41
    dependabot[bot] opened #136
  • May 09 23:41

    dependabot[bot] on npm_and_yarn

    Bump hosted-git-info from 2.7.1… (compare)

  • May 07 01:17
    dependabot[bot] labeled #135
  • May 07 01:17
    dependabot[bot] opened #135
  • May 07 01:17

    dependabot[bot] on npm_and_yarn

    Bump underscore from 1.9.1 to 1… (compare)

  • May 06 20:48

    dependabot[bot] on npm_and_yarn

    (compare)

  • May 06 20:48
    dependabot[bot] closed #125
  • May 06 20:48
    dependabot[bot] commented #125
  • May 06 20:48
    dependabot[bot] labeled #134
  • May 06 20:48
    dependabot[bot] opened #134
  • May 06 20:48

    dependabot[bot] on npm_and_yarn

    Bump lodash from 4.17.15 to 4.1… (compare)

  • May 06 17:25
    dependabot[bot] labeled #133
  • May 06 17:25
    dependabot[bot] opened #133
  • May 06 17:25

    dependabot[bot] on npm_and_yarn

    Bump handlebars from 4.5.3 to 4… (compare)

Seth Lemoine
@mrseth01
const NBA = require("../lambda/custom/nba-voice-library/NBA");

test("gets schedule from endpoint", async () => {
  expect.assertions(1);
  const data = await NBA.schedule();
  expect(data.length).toBe(4);
});
Juan Perata
@jperata
Hi @mrseth01 , your way sounds about right. Since you are not testing the Alexa section you don't need to introduce virtual-alexa in that section. We recommend that you also add some tests with our library to emulate Alexa too, it will interact with your endpoint unless you do some steps to mock it.
Mina Saleeb
@saleebm
Hey I'm getting an error about my network connection every time. I even tried following the node example but got this same error:
```
Something went wrong. Please check your network connection and try again.
Mina Saleeb
@saleebm
I'm using node v10, stack is RequestError: Error: read ECONNRESET\n at new RequestError ... t TLSSocket.socketErrorListener (_http_client.js:392:9)\n at TLSSocket.emit with macOS
John Kelvie
@jkelvie
Hi @saleebm - what tool are you using? And what command are you sending?
Mina Saleeb
@saleebm
Hey thank you for the quick response, I sent the command bst init and then I also tried node ./node_modules/bespoken-tools/bin/bst-proxy.js lambda ./src/index.ts
I installed bespoken-tools globally with npm v10.18.1 and also tried doing it in a local project,
Is it maybe because I use node version manager and I have my default set to v13?
Juan Perata
@jperata
Hi @saleebm - to use the proxy with the lambda parameters you would need to point to the ".js" file instead of ".ts" one.
Also, are you behind a corporate proxy?
Mina Saleeb
@saleebm
Oh ok, I see, and yes I actually might be, I'm at a college. I'll have to try again and see later, thank you
Mark Tucker
@rmtuckerphx
What is the best way to build a Connections.Response? It could include values for Buy, Upsell, Cancel, Setup, Charge & ACCEPTED, DECLINED, ALREADY_PURCHASED, ERROR
pintonos
@pintonos
Hi there, i have problems while mocking dynamoDB. Running it locally works fine, but when using it in the GitLab CI following error occurs: Uncaught exception: AskSdk.DynamoDbPersistenceAdapter Error: Could not create table (...): The security token included in the request is invalid. Any ideas?
John Kelvie
@jkelvie
Hmm...@pintonos - do you have a sample you can share with us?
pintonos
@pintonos
@jkelvie not really. I just used the alexa.dynamoDB().mock(); Do you ever have tested it in a CI (GitLab) environment? Perhaps this produces some new problems, like this one.
John Kelvie
@jkelvie
Yes we use CI environments regularly, including Gitlab. But I have not seen that particular error before.
akhil1296
@akhil1296
Hi, I am made alexa skill that uses third party APIs as well as few HTTP apps. I am not understanding how to do the unit testing for such cases. Any kind of help from you people will be highly appreciated. Thanks
allthepies
@allthepies

Hi, I am made alexa skill that uses third party APIs as well as few HTTP apps. I am not understanding how to do the unit testing for such cases. Any kind of help from you people will be highly appreciated. Thanks

Hi, I use nock to mock the API /HTTP calls.

Juan Perata
@jperata
Hi @akhil1296 , our full documentation for unit testing in Alexa using YML scripts is here. For your specific question if you are using YML, we set up an environment variable that you can use to change to get specific responses.
Since you are asking in the Virtual Alexa channel maybe you are using Virtual Alexa directly with Jest or Mocha, if that's the case then Nock is a great solution to mock API calls as @allthepies suggest.
spham1
@spham1_gitlab
hi
i have an issue after lauch bst test
Cannot find module '/home/sylvain/spham/alexa/skill-sample-nodejs-hello-world/index.js' from 'ModuleInvoker.js'
allthepies
@allthepies
Hi Guys. I 'm using the virtual-alexa dynamoDB mock and want to pre-populate the mocked dynamo table with a set of attributes at the start of a test. Is this possible ?
John Kelvie
@jkelvie
Hi @allthepies - if you activate the mock, and then make call to DynamoDB put - either directly via the API or via the AWS SDK, it will set the state of the table
allthepies
@allthepies
Hi, Tried calling PutItem on the AWS DynamoDB class after enabling the bespoken dynamo mock and get an exception with the AWS call asking for a region
allthepies
@allthepies
Sorted now, had the execution order wrong
John Kelvie
@jkelvie
Great....glad to hear it
Dan
@dhazrati_twitter
Hello :wave: Has anybody experiences issues setting environment variables with virtual-alexa? I'm currently running unit tests with this lib and Jest, but for some reason, any custom process.env.FOO env vars are not being picked up from my node Lambda locally. Any ideas?
John Kelvie
@jkelvie
Hi @dhazrati_twitter how is your Lambda being invoked?
Dan
@dhazrati_twitter

Hi @jkelvie - the Lambda handler is being invoked as a JS function directly.

import { handler } from 'src/index';
import { VirtualAlexa } from 'virtual-alexa';
const alexa = VirtualAlexa.Builder()
    .handler(handler)
    ...
   . build()

I've tried setting the env variables before and after the virtual alexa client is built, but no luck. I can only seem to set variables outside of our test file i.e. SOME_VAR=true jest

John Kelvie
@jkelvie
Okay, and where are you setting the environment variable that it does NOT work?
Also, I take it that it does work if it is set in the CLI via an export?
Dan
@dhazrati_twitter

@jkelvie Yes you're correct. It works when the environment variable is exported as part of my test command e.g. FOO=BAR npm run test.

My Jest test file looks something like this:

import { handler } from 'src/index';
import { VirtualAlexa } from 'virtual-alexa';

describe("Given some state", () => {
  beforeEach(async () => {
    process.env.FOO = "bar";

    const alexa = VirtualAlexa.Builder().handler(handler).build();
    await alexa.launch();
  })

  it("Then some expection", () => {
    expect("something").toBe("something")
  })
})

This is not currently working, as the environment variable is NOT picked up inside my handler.

I will try and create a minimal reproduction this weekend, if that will help?
John Kelvie
@jkelvie
Yes, that would be helpful. I can't think of what would cause this - especially given the example you show above.
I naturally tend to focus on the process-spawning that Jest does, but that would not apply in the sample code you show.
Dan
@dhazrati_twitter
Hi @jkelvie, I tried to create a minimal reproduction.... and couldn't.... so I decided to take another look at the original code and spotted a bug in our code (facepalm). Apologies and thanks for taking a look!
John Kelvie
@jkelvie
Glad to hear that it's working, @dhazrati_twitter !
allthepies
@allthepies
Hi, I've got the latest virtual alexa installed (0.7.7) and the inSkillPurchaseResponse() method doesn't exist in the SkillRequest object. Has the package been generated correctly ?
allthepies
@allthepies
Actually the latest using npm install is 0.7.5. Tried both and they don't have the ISP support....
Diego Martín
@dmarvp
Hi @allthepies, we just published a new version that should fix your issue. Please let us know if the problem persists.
allthepies
@allthepies
Hi, yes the method is now there! However when I use it, no session is present in the alexa request and so my code (which expects one) fails. Is this an error in virtual alexa or do I need to add session data to the request prior to sending ?
allthepies
@allthepies
OK, I've added a session object using the same request() and it works, nearly! You have a bug in your Connections.Response code, the status.code value should be a string e.g. "200" whereas your code uses a numeric, 200. My code performs a type-safe check on the status code and rejects the numeric 200. You can find the Amazon documentation for the request here -> https://developer.amazon.com/en-US/docs/alexa/in-skill-purchase/add-isps-to-a-skill.html
Ashish Jha
@TheDreamSaver

Hi

@dmarvp @jkelvie

I was trying to run the https://gitlab.com/bespoken/utterance-testing-recipe locally, but was getting this error

> utterance-testing-recipe@0.1.0 utterances /mnt/c/Users/thedreamsaver/Downloads/utterance-testing-recipe-master
> bbt process input/utterance-test.json

command: process arg: input/utterance-test.json
No device-pool provider specified - using default.
DEVICE create token: google-3a592bde-0dcf-43a9-9c90-5910223643dd skipSTT: false tags:
Config loading class: ./csv-source using paths: /mnt/c/Users/thedreamsaver/Downloads/utterance-testing-recipe-master,/mnt/c/Users/thedreamsaver/Downloads/utterance-testing-recipe-master/node_modules/bespoken-batch-tester/src for service: source
CSV-SOURCE LOADALL input file: input/utterances.csv
BATCH READ pre-filter: 4 post-filter: 4
DEVICE LOCK tags:  count: 1
DEVICE LOCK acquire tags:  available: 0 token: google-3a592bde-0dcf-43a9-9c90-5910223643dd
RUNNER PROCESS run: utterance-tester_2021-04-27T20-21-42 utterance: search for museums near me
DEVICE LOCK tags:  count: 0
Config loading class: ./src/utterance-interceptor using paths: /mnt/c/Users/thedreamsaver/Downloads/utterance-testing-recipe-master,/mnt/c/Users/msi/Downloads/utterance-testing-recipe-master/node_modules/bespoken-batch-tester/src for service: interceptor
DEVICE MESSAGE error: invalid literal for boolean. Not a string. retrying 10 seconds
DEVICE MESSAGE error: invalid literal for boolean. Not a string. retrying 10 seconds
when i run
npm run utterances
John Kelvie
@jkelvie
Hi Ashish, the version of the batch-tester being used in that project was outdated. I just updated it to the newer version. If you pull the latest version of the project, it should work for you.
Ashish Jha
@TheDreamSaver
Thanks John! It works now!