Hello,
I created a Hello World Skill as an Alexa Hosted Skill (Node.js) and tried to convert it to Typescript.
I renamed index.js to index.ts and changed the content to content here described:
In package.json I added "build": "tsc",
"scripts": { "build": "tsc", "test": "echo \"Error: no test specified\" && exit 1" },
I added a tsconfig.json
{ "compilerOptions": { "lib": [ "es2017" ], "target": "ES2015", "module": "commonjs", "outDir": "./", "rootDir": "./", "moduleResolution": "node", "strict": true, "noUnusedLocals": true }, "include": [ "./**/*" ], "exclude": [ "node_modules" ] }
But when I try to test it, I get the following error:
"errorType": "Runtime.HandlerNotFound", "errorMessage": "index.handler is undefined or not exported", "stack": [ "Runtime.HandlerNotFound: index.handler is undefined or not exported", " at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)", " at Object.<anonymous> (/var/runtime/index.js:45:30)", " at Module._compile (internal/modules/cjs/loader.js:778:30)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)", " at Module.load (internal/modules/cjs/loader.js:653:32)", " at tryModuleLoad (internal/modules/cjs/loader.js:593:12)", " at Function.Module._load (internal/modules/cjs/loader.js:585:3)", " at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)", " at startup (internal/bootstrap/node.js:283:19)", " at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)" ]
What is my problem, can you please help me.