Comments (10)
I was just in the AWS console a moment ago. I created a new lambda function via the console. In the function configuration tab, the handler was set to index.handle
(NO r
) by default. However the boilerplate code provided for the lambda function had exports.handler
(WITH r
). This was a brief source of confusion for me
from alexa-app.
Found the problem, looks like module.exports = app;
is causing this. What's the recommended way to combine alexa-app-server and lambda? I am trying to use alexa-app-server in development and use apex to deploy the function to lambda.
Can make it work with some ENV settings, but seems ugly.
if (process.env['LAMBDA_FUNCTION_NAME'] != null) {
console.log("AWS lambda")
exports.handle = app.lambda();
} else if (process.env['ENV'] == 'development') {
console.log("Development Mode")
module.exports = app;
} else {
var fs = require('fs');
fs.writeFileSync('schema.json', app.schema());
fs.writeFileSync('utterances.txt', app.utterances());
console.log('Schema and utterances exported!');
}
from alexa-app.
@dblock the module.exports = app
will make a handler
function available on the export automatically so you can do this in lambda as well. Your issue is probably that you're using handle
instead of handler
in your lambda function definition.
You can also do exports.handle = app.lambda()
regardless of whether this is running in a lambda context or not.
from alexa-app.
@ajcrites Are you saying I can collapse my dev mode with lambda mode in https://github.com/artsy/elderfield/blob/master/functions/artsy/index.js#L123?
from alexa-app.
This needs more thorough README. I'm going to close this for now though.
from alexa-app.
I've notice that deploying with Apex changes the handler to "index.handle" where all the sdk examples uses handler. For this you'll want to modify Apex's project.json and add "handler":"index.handler"
from alexa-app.
@thegregthomp Can you please PR any doc changes?
from alexa-app.
@dblock for me this is kind of an edge case in that you'd need to be using Apex for lambda deployments. I'm not sure that's worthy of a note in the docs because I'm not sure how many people actually deploy this way. If you feel it's a lot of people, I can do that.
from alexa-app.
Not sure, your call. I think lots of people use Apex, we do - http://artsy.github.io/blog/2016/11/30/bringing-artsy-to-amazon-echo-alexa/
from alexa-app.
If something can be better documented, please PR!
from alexa-app.
Related Issues (20)
- Support for CanFulfillIntentRequest HOT 7
- Errors when using KeepAlive-style CloudWatch events HOT 5
- Patch for directive Dialog.Delegate HOT 2
- Cannot get directive display to work in Alexa skill. HOT 5
- Not able to use alexa-app HOT 2
- APL Support ? HOT 6
- VideoApp Directive HOT 1
- alexa-verifier-middleware HOT 1
- request.userId returning the wrong user HOT 3
- Multi turn dialog
- How we can get user permissions list?
- ssml lowercase
- Firebase Promise Failure HOT 2
- Support for In-Skill Purchases (ISP)? HOT 1
- INVALID_REQUEST_TYPE HOT 3
- Chained callbacks not working. HOT 2
- Issues testing locally the Skill: alexa-app + express + ngrok HOT 2
- Xxxxx
- REPLACE_ALL play behavior has no effect HOT 1
- Catch User Profile Data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alexa-app.