Closed ttruga closed 6 years ago
I'm also getting the exact same CloudWatch error:
Unable to import module 'dist/index': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
@ttruga did you find a solution?
@sebsto I don't suppose you could help us out here could you please?
By exporting my Lambda function (Actions > Export function) I can see that there is no dist directory in there:
.
├── node_modules
│ ├── @types
│ │ ├── chai
│ │ ├── mocha
│ │ └── node
│ ├── ansi-styles
│ ├── arrify
│ ├── ask-sdk
│ │ └── dist
│ │ └── skill
│ │ └── factory
│ ├── ask-sdk-core
│ │ └── dist
│ │ ├── attributes
│ │ │ └── persistence
│ │ ├── dispatcher
│ │ │ ├── error
│ │ │ └── request
│ │ │ ├── handler
│ │ │ ├── interceptor
│ │ │ └── mapper
│ │ ├── response
│ │ ├── service
│ │ ├── skill
│ │ │ └── factory
│ │ └── util
│ ├── ask-sdk-dynamodb-persistence-adapter
│ │ └── dist
│ │ ├── attributes
│ │ │ └── persistence
│ │ └── utils
│ ├── ask-sdk-model
│ ├── assertion-error
│ ├── aws-sdk
│ │ ├── apis
│ │ ├── clients
│ │ ├── dist
│ │ ├── dist-tools
│ │ ├── lib
│ │ │ ├── cloudfront
│ │ │ ├── credentials
│ │ │ ├── dynamodb
│ │ │ ├── http
│ │ │ ├── json
│ │ │ ├── model
│ │ │ ├── polly
│ │ │ ├── protocol
│ │ │ ├── query
│ │ │ ├── rds
│ │ │ ├── react-native
│ │ │ ├── s3
│ │ │ ├── services
│ │ │ ├── signers
│ │ │ └── xml
│ │ └── scripts
│ │ ├── changelog
│ │ ├── lib
│ │ └── region-checker
│ ├── balanced-match
│ ├── base64-js
│ │ └── test
│ ├── brace-expansion
│ ├── browser-stdout
│ ├── buffer
│ │ ├── bin
│ │ └── test
│ │ └── node
│ ├── buffer-from
│ ├── chai
│ │ └── lib
│ │ └── chai
│ │ ├── core
│ │ ├── interface
│ │ └── utils
│ ├── chalk
│ │ └── types
│ ├── check-error
│ ├── color-convert
│ ├── color-name
│ ├── commander
│ │ └── typings
│ ├── concat-map
│ │ ├── example
│ │ └── test
│ ├── debug
│ │ └── src
│ ├── deep-eql
│ ├── diff
│ │ ├── dist
│ │ └── lib
│ │ ├── convert
│ │ ├── diff
│ │ ├── patch
│ │ └── util
│ ├── escape-string-regexp
│ ├── events
│ │ └── tests
│ ├── fs.realpath
│ ├── get-func-name
│ ├── glob
│ ├── growl
│ │ └── lib
│ ├── has-flag
│ ├── he
│ │ ├── bin
│ │ └── man
│ ├── ieee754
│ │ └── test
│ ├── inflight
│ ├── inherits
│ ├── isarray
│ ├── jmespath
│ │ ├── artifacts
│ │ └── test
│ │ └── compliance
│ ├── lodash
│ │ └── fp
│ ├── make-error
│ │ └── dist
│ ├── minimatch
│ ├── minimist
│ │ ├── example
│ │ └── test
│ ├── mkdirp
│ │ ├── bin
│ │ ├── examples
│ │ └── test
│ ├── mocha
│ │ ├── bin
│ │ └── lib
│ │ ├── browser
│ │ ├── interfaces
│ │ └── reporters
│ ├── ms
│ ├── once
│ ├── path-is-absolute
│ ├── pathval
│ ├── punycode
│ ├── querystring
│ │ └── test
│ ├── sax
│ │ └── lib
│ ├── source-map
│ │ ├── dist
│ │ └── lib
│ ├── source-map-support
│ ├── supports-color
│ ├── ts-node
│ │ ├── dist
│ │ ├── node_modules
│ │ │ └── minimist
│ │ │ ├── example
│ │ │ └── test
│ │ └── register
│ ├── type-detect
│ ├── typescript
│ │ ├── bin
│ │ └── lib
│ │ ├── cs
│ │ ├── de
│ │ ├── es
│ │ ├── fr
│ │ ├── it
│ │ ├── ja
│ │ ├── ko
│ │ ├── pl
│ │ ├── pt-br
│ │ ├── ru
│ │ ├── tr
│ │ ├── zh-cn
│ │ └── zh-tw
│ ├── url
│ ├── uuid
│ │ ├── bin
│ │ └── lib
│ ├── wrappy
│ ├── xml2js
│ │ └── lib
│ ├── xmlbuilder
│ │ └── lib
│ └── yn
├── src
│ └── utils
└── test
├── request
└── utils
So is the question, in my case at least, what failed to build the dist JavaScript?
OK, so the reason is that because this is a TypeScript project it first needs compiling into JavaScript.
So the missing command just before "ask deploy" is: (cd lambda && tsc)
Then you get a single-stream/lambda/dist/ directory (due to the settings in single-stream/lambda/ts-config.json):
$ ls -al lambda/dist/
total 168
drwxr-xr-x 21 xxx yyy 672 8 Jun 15:37 .
drwxr-xr-x 8 xxx yyy 256 8 Jun 15:37 ..
-rw-r--r-- 1 xxx yyy 1502 8 Jun 15:38 AudioAssets.js
-rw-r--r-- 1 xxx yyy 938 8 Jun 15:38 AudioAssets.js.map
-rw-r--r-- 1 xxx yyy 3599 8 Jun 15:38 AudioController.js
-rw-r--r-- 1 xxx yyy 1965 8 Jun 15:38 AudioController.js.map
-rw-r--r-- 1 xxx yyy 3541 8 Jun 15:38 AudioHandlers.js
-rw-r--r-- 1 xxx yyy 1389 8 Jun 15:38 AudioHandlers.js.map
-rw-r--r-- 1 xxx yyy 596 8 Jun 15:38 CanPlayAudioCheck.js
-rw-r--r-- 1 xxx yyy 502 8 Jun 15:38 CanPlayAudioCheck.js.map
-rw-r--r-- 1 xxx yyy 748 8 Jun 15:38 Constants.js
-rw-r--r-- 1 xxx yyy 376 8 Jun 15:38 Constants.js.map
-rw-r--r-- 1 xxx yyy 11413 8 Jun 15:38 IntentHandlers.js
-rw-r--r-- 1 xxx yyy 5732 8 Jun 15:38 IntentHandlers.js.map
-rw-r--r-- 1 xxx yyy 1315 8 Jun 15:38 SkillEventHandler.js
-rw-r--r-- 1 xxx yyy 444 8 Jun 15:38 SkillEventHandler.js.map
-rw-r--r-- 1 xxx yyy 1711 8 Jun 15:38 Strings.js
-rw-r--r-- 1 xxx yyy 802 8 Jun 15:38 Strings.js.map
-rw-r--r-- 1 xxx yyy 2788 8 Jun 15:38 index.js
-rw-r--r-- 1 xxx yyy 1460 8 Jun 15:38 index.js.map
drwxr-xr-x 8 xxx yyy 256 8 Jun 15:37 utils
And that needs running every time you change a .ts file, unless you have a watcher or such like running I guess.
Looks like you nailed it down. I forgot to add Typescript compilation instructions. I will update the readme over the weekend. Thanks for helping !
--Seb
Sent from a smartphone. Please, accept apologies for brevity and typos.
On 8 Jun 2018, at 16:43, benappware notifications@github.com wrote:
OK, so the reason is that because this is a TypeScript project it first needs compiling into JavaScript.
So the missing command just before "ask deploy" is: (cd lambda && tsc)
Then you get a single-stream/lambda/dist/ directory (due to the settings in single-stream/lambda/ts-config.json):
$ ls -al lambda/dist/ total 168 drwxr-xr-x 21 xxx yyy 672 8 Jun 15:37 . drwxr-xr-x 8 xxx yyy 256 8 Jun 15:37 .. -rw-r--r-- 1 xxx yyy 1502 8 Jun 15:38 AudioAssets.js -rw-r--r-- 1 xxx yyy 938 8 Jun 15:38 AudioAssets.js.map -rw-r--r-- 1 xxx yyy 3599 8 Jun 15:38 AudioController.js -rw-r--r-- 1 xxx yyy 1965 8 Jun 15:38 AudioController.js.map -rw-r--r-- 1 xxx yyy 3541 8 Jun 15:38 AudioHandlers.js -rw-r--r-- 1 xxx yyy 1389 8 Jun 15:38 AudioHandlers.js.map -rw-r--r-- 1 xxx yyy 596 8 Jun 15:38 CanPlayAudioCheck.js -rw-r--r-- 1 xxx yyy 502 8 Jun 15:38 CanPlayAudioCheck.js.map -rw-r--r-- 1 xxx yyy 748 8 Jun 15:38 Constants.js -rw-r--r-- 1 xxx yyy 376 8 Jun 15:38 Constants.js.map -rw-r--r-- 1 xxx yyy 11413 8 Jun 15:38 IntentHandlers.js -rw-r--r-- 1 xxx yyy 5732 8 Jun 15:38 IntentHandlers.js.map -rw-r--r-- 1 xxx yyy 1315 8 Jun 15:38 SkillEventHandler.js -rw-r--r-- 1 xxx yyy 444 8 Jun 15:38 SkillEventHandler.js.map -rw-r--r-- 1 xxx yyy 1711 8 Jun 15:38 Strings.js -rw-r--r-- 1 xxx yyy 802 8 Jun 15:38 Strings.js.map -rw-r--r-- 1 xxx yyy 2788 8 Jun 15:38 index.js -rw-r--r-- 1 xxx yyy 1460 8 Jun 15:38 index.js.map drwxr-xr-x 8 xxx yyy 256 8 Jun 15:37 utils And that needs running every time you change a .ts file, unless you have a watcher or such like running I guess.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Doc is fixed, apologies for the churn. https://github.com/alexa/skill-sample-nodejs-audio-player/commit/b055da71fdcd535491fb50fcffeb5539513ea78d
Im using the single-stream folder with the sdkv2 branch, followed all the instructions in order to configure all permissions. Tried testing the skill from both the developer console and also executing
I always get on cloud watch the following error:
I also changed the handler as mentioned on the README file using the following command:
I also tried executing the lambda function directly from the lambda dashboard using the pre populated example events and I always get the same response.. it can't find the entry point to the lambda function.
Sadly because the function is too big so is impossible to edit it inline in order to detect which is the actual entry point of the function.
it is always:
Anybody knows why is this happening or perhaps which one is the actual entry point for the function? or perhaps there is a way of not using TS so it can behave like a typical ES6 JS function?