Closed jlincoln closed 8 years ago
My bad. I had made a change to the packaging/bundler-config file when working on specifying the 1.9.9 Bundler version and forgot about it. I reverted to the initial version of this file and the rake error is now gone.
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 https://github.com/lorennorman/ruby-on-lambda/issues/4.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman notifications@github.com wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 https://github.com/lorennorman/ruby-on-lambda/issues/4.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
No idea, but you might also look here: https://github.com/qrush/lambda-function-wrapper-ruby
...and he has resources in his README as well.
On Sat, Mar 19, 2016 at 9:07 AM, Jason notifications@github.com wrote:
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman notifications@github.com wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 https://github.com/lorennorman/ruby-on-lambda/issues/4.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969>
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122
Thank you for the link. I was able to pass the event and context parameter values over to the app.rb from the index.js through the app bash script.
Getting the value from the app.rb back is not quite working though. It’s coming out with escape characters that pose a problem to the Alexa service. It doesn’t look valid to the Alexa service.
"{\"version\":\"1.0\",\"response\":{\"outputSpeech\":{\"type\":\"PlainText\",\"text\":\"Ruby is running ready!\"},\"shouldEndSession\":true}}\n"
I need to find a way for it to return as:
{"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Ruby is running ready!"},"shouldEndSession":true}}
Here is the index.js script.
var spawn = require('child_process').spawn;
var invokeRubyApp = "./app";
exports.handler = function(event, context) { var result = ''; console.log("Starting process: " + invokeRubyApp); // console.log("event is " + JSON.stringify(event, null, 2)); // console.log("context is " + JSON.stringify(context, null, 2)); var child = spawn(invokeRubyApp, [JSON.stringify(event, null, 2), JSON.stringify(context, null, 2)]);
child.stdout.on('data', function (data) { console.log("stdout:\n"+data); result += data; }); child.stderr.on('data', function (data) { console.log("stderr:\n"+data); });
child.on('close', function (code) { if (code === 0) { // context.succeed("Process completed: " + invokeRubyApp); console.log("result is " + result); // context.succeed("Process completed: " + invokeRubyApp); context.succeed(result); } else { context.fail("Process \"" + invokeRubyApp + "\" exited with code: " + code); } }); }
Here is the wrapper.sh bash script that passes the event $1 and context $2 over to the app.rb script.
set -e
SELFDIR="dirname \"$0\"
"
SELFDIR="cd \"$SELFDIR\" && pwd
"
export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile" unset BUNDLE_IGNORE_CONFIG
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/app.rb" "$1" "$2"
Jason
On Mar 19, 2016, at 5:37 PM, Loren Norman notifications@github.com wrote:
No idea, but you might also look here: https://github.com/qrush/lambda-function-wrapper-ruby
...and he has resources in his README as well.
On Sat, Mar 19, 2016 at 9:07 AM, Jason notifications@github.com wrote:
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman notifications@github.com wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 https://github.com/lorennorman/ruby-on-lambda/issues/4.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969>
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198801219
I would need to see the Alexa code that is failing, it seems like you're handing it the string with escape characters in it directly, when I would expect you to call JSON.parse on it first to get a real object to pass around.
On Sat, Mar 19, 2016 at 10:42 PM, Jason notifications@github.com wrote:
Thank you for the link. I was able to pass the event and context parameter values over to the app.rb from the index.js through the app bash script.
Getting the value from the app.rb back is not quite working though. It’s coming out with escape characters that pose a problem to the Alexa service. It doesn’t look valid to the Alexa service.
"{\"version\":\"1.0\",\"response\":{\"outputSpeech\":{\"type\":\"PlainText\",\"text\":\"Ruby is running ready!\"},\"shouldEndSession\":true}}\n"
I need to find a way for it to return as:
{"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Ruby is running ready!"},"shouldEndSession":true}}
Here is the index.js script.
var spawn = require('child_process').spawn;
var invokeRubyApp = "./app";
exports.handler = function(event, context) { var result = ''; console.log("Starting process: " + invokeRubyApp); // console.log("event is " + JSON.stringify(event, null, 2)); // console.log("context is " + JSON.stringify(context, null, 2)); var child = spawn(invokeRubyApp, [JSON.stringify(event, null, 2), JSON.stringify(context, null, 2)]);
child.stdout.on('data', function (data) { console.log("stdout:\n"+data); result += data; }); child.stderr.on('data', function (data) { console.log("stderr:\n"+data); });
child.on('close', function (code) { if (code === 0) { // context.succeed("Process completed: " + invokeRubyApp); console.log("result is " + result); // context.succeed("Process completed: " + invokeRubyApp); context.succeed(result); } else { context.fail("Process \"" + invokeRubyApp + "\" exited with code: " + code); } }); }
Here is the wrapper.sh bash script that passes the event $1 and context $2 over to the app.rb script.
!/bin/bash
set -e
Figure out where this script is located.
SELFDIR="
dirname \"$0\"
" SELFDIR="cd \"$SELFDIR\" && pwd
"Tell Bundler where the Gemfile and gems are.
export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile" unset BUNDLE_IGNORE_CONFIG
Run the actual app using the bundled Ruby interpreter, with Bundler
activated.
echo "Param 1 is " $1
echo "Param 2 is " $2
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/app.rb" "$1" "$2"
Jason
On Mar 19, 2016, at 5:37 PM, Loren Norman notifications@github.com wrote:
No idea, but you might also look here: https://github.com/qrush/lambda-function-wrapper-ruby
...and he has resources in his README as well.
On Sat, Mar 19, 2016 at 9:07 AM, Jason notifications@github.com wrote:
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman notifications@github.com wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 <https://github.com/lorennorman/ruby-on-lambda/issues/4 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub <
https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198801219
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198834760
It’s the response that is sent to the Alexa service that I have in my prior email. It should look like normal JSON. In app.rb I call the AlexaRubykit as shown below.
response = AlexaRubykit::Response.new response.add_speech('Ruby is running ready!’); puts response.build_response
The std out shows the expected JSON but when the index.js grabs the stdout and pushes it to the context.succeed the escape characters are added as previously shown and the Alexa service doesn’t recognize it as a valid response.
I tried removing the std out from the equation by using a /tmp/alexa_response.txt file. I write to in the app.rb and read it in the index.js. The same thing happens. The quotes are escaped in the resulting value.
It’s down to this one obstacle.
Thanks, Jason
On Mar 20, 2016, at 10:36 AM, Loren Norman notifications@github.com wrote:
I would need to see the Alexa code that is failing, it seems like you're handing it the string with escape characters in it directly, when I would expect you to call JSON.parse on it first to get a real object to pass around.
On Sat, Mar 19, 2016 at 10:42 PM, Jason notifications@github.com wrote:
Thank you for the link. I was able to pass the event and context parameter values over to the app.rb from the index.js through the app bash script.
Getting the value from the app.rb back is not quite working though. It’s coming out with escape characters that pose a problem to the Alexa service. It doesn’t look valid to the Alexa service.
"{\"version\":\"1.0\",\"response\":{\"outputSpeech\":{\"type\":\"PlainText\",\"text\":\"Ruby is running ready!\"},\"shouldEndSession\":true}}\n"
I need to find a way for it to return as:
{"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Ruby is running ready!"},"shouldEndSession":true}}
Here is the index.js script.
var spawn = require('child_process').spawn;
var invokeRubyApp = "./app";
exports.handler = function(event, context) { var result = ''; console.log("Starting process: " + invokeRubyApp); // console.log("event is " + JSON.stringify(event, null, 2)); // console.log("context is " + JSON.stringify(context, null, 2)); var child = spawn(invokeRubyApp, [JSON.stringify(event, null, 2), JSON.stringify(context, null, 2)]);
child.stdout.on('data', function (data) { console.log("stdout:\n"+data); result += data; }); child.stderr.on('data', function (data) { console.log("stderr:\n"+data); });
child.on('close', function (code) { if (code === 0) { // context.succeed("Process completed: " + invokeRubyApp); console.log("result is " + result); // context.succeed("Process completed: " + invokeRubyApp); context.succeed(result); } else { context.fail("Process \"" + invokeRubyApp + "\" exited with code: " + code); } }); }
Here is the wrapper.sh bash script that passes the event $1 and context $2 over to the app.rb script.
!/bin/bash
set -e
Figure out where this script is located.
SELFDIR="
dirname \"$0\"
" SELFDIR="cd \"$SELFDIR\" && pwd
"Tell Bundler where the Gemfile and gems are.
export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile" unset BUNDLE_IGNORE_CONFIG
Run the actual app using the bundled Ruby interpreter, with Bundler
activated.
echo "Param 1 is " $1
echo "Param 2 is " $2
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/app.rb" "$1" "$2"
Jason
On Mar 19, 2016, at 5:37 PM, Loren Norman notifications@github.com wrote:
No idea, but you might also look here: https://github.com/qrush/lambda-function-wrapper-ruby
...and he has resources in his README as well.
On Sat, Mar 19, 2016 at 9:07 AM, Jason notifications@github.com wrote:
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman notifications@github.com wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason notifications@github.com wrote:
Closed #4 <https://github.com/lorennorman/ruby-on-lambda/issues/4 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub <
https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198801219
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198834760
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198950882
This is the sample Node.js script Amazon provides. I don’t know JavaScript at all. But based upon what happens in both of my attempts I’m thinking the index.js needs something specific to the Alexa service.
/**
// Route the incoming request based on type (LaunchRequest, IntentRequest, // etc.) The JSON body of the request is provided in the event parameter. exports.handler = function (event, context) { try { console.log("event.session.application.applicationId=" + event.session.application.applicationId);
/**
* Uncomment this if statement and populate with your skill's application ID to
* prevent someone else from configuring a skill that sends requests to this function.
*/
/*
if (event.session.application.applicationId !== "amzn1.echo-sdk-ams.app.[unique-value-here]") {
context.fail("Invalid Application ID");
}
*/
if (event.session.new) {
onSessionStarted({requestId: event.request.requestId}, event.session);
}
if (event.request.type === "LaunchRequest") {
onLaunch(event.request,
event.session,
function callback(sessionAttributes, speechletResponse) {
context.succeed(buildResponse(sessionAttributes, speechletResponse));
});
} else if (event.request.type === "IntentRequest") {
onIntent(event.request,
event.session,
function callback(sessionAttributes, speechletResponse) {
context.succeed(buildResponse(sessionAttributes, speechletResponse));
});
} else if (event.request.type === "SessionEndedRequest") {
onSessionEnded(event.request, event.session);
context.succeed();
}
} catch (e) {
context.fail("Exception: " + e);
}
};
/**
/**
Called when the user launches the skill without specifying what they want. */ function onLaunch(launchRequest, session, callback) { console.log("onLaunch requestId=" + launchRequest.requestId + ", sessionId=" + session.sessionId);
// Dispatch to your skill's launch. getWelcomeResponse(callback); }
/**
Called when the user specifies an intent for this skill. */ function onIntent(intentRequest, session, callback) { console.log("onIntent requestId=" + intentRequest.requestId + ", sessionId=" + session.sessionId);
var intent = intentRequest.intent, intentName = intentRequest.intent.name;
// Dispatch to your skill's intent handlers if ("MyColorIsIntent" === intentName) { setColorInSession(intent, session, callback); } else if ("WhatsMyColorIntent" === intentName) { getColorFromSession(intent, session, callback); } else if ("AMAZON.HelpIntent" === intentName) { getWelcomeResponse(callback); } else { throw "Invalid intent"; } }
/**
// --------------- Functions that control the skill's behavior -----------------------
function getWelcomeResponse(callback) { // If we wanted to initialize the session to have some attributes we could add those here. var sessionAttributes = {}; var cardTitle = "Welcome"; var speechOutput = "Welcome to the Alexa Skills Kit sample. " + "Please tell me your favorite color by saying, my favorite color is red"; // If the user either does not reply to the welcome message or says something that is not // understood, they will be prompted again with this text. var repromptText = "Please tell me your favorite color by saying, " + "my favorite color is red"; var shouldEndSession = false;
callback(sessionAttributes,
buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));
}
/**
Sets the color in the session and prepares the speech to reply to the user. */ function setColorInSession(intent, session, callback) { var cardTitle = intent.name; var favoriteColorSlot = intent.slots.Color; var repromptText = ""; var sessionAttributes = {}; var shouldEndSession = false; var speechOutput = "";
if (favoriteColorSlot) { var favoriteColor = favoriteColorSlot.value; sessionAttributes = createFavoriteColorAttributes(favoriteColor); speechOutput = "I now know your favorite color is " + favoriteColor + ". You can ask me " + "your favorite color by saying, what's my favorite color?"; repromptText = "You can ask me your favorite color by saying, what's my favorite color?"; } else { speechOutput = "I'm not sure what your favorite color is. Please try again"; repromptText = "I'm not sure what your favorite color is. You can tell me your " + "favorite color by saying, my favorite color is red"; }
callback(sessionAttributes, buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession)); }
function createFavoriteColorAttributes(favoriteColor) { return { favoriteColor: favoriteColor }; }
function getColorFromSession(intent, session, callback) { var favoriteColor; var repromptText = null; var sessionAttributes = {}; var shouldEndSession = false; var speechOutput = "";
if (session.attributes) {
favoriteColor = session.attributes.favoriteColor;
}
if (favoriteColor) {
speechOutput = "Your favorite color is " + favoriteColor + ". Goodbye.";
shouldEndSession = true;
} else {
speechOutput = "I'm not sure what your favorite color is, you can say, my favorite color " +
" is red";
}
// Setting repromptText to null signifies that we do not want to reprompt the user.
// If the user does not respond or says something that is not understood, the session
// will end.
callback(sessionAttributes,
buildSpeechletResponse(intent.name, speechOutput, repromptText, shouldEndSession));
}
// --------------- Helpers that build all of the responses -----------------------
function buildSpeechletResponse(title, output, repromptText, shouldEndSession) { return { outputSpeech: { type: "PlainText", text: output }, card: { type: "Simple", title: "SessionSpeechlet - " + title, content: "SessionSpeechlet - " + output }, reprompt: { outputSpeech: { type: "PlainText", text: repromptText } }, shouldEndSession: shouldEndSession }; }
function buildResponse(sessionAttributes, speechletResponse) { return { version: "1.0", sessionAttributes: sessionAttributes, response: speechletResponse }; }
Jason
On Mar 20, 2016, at 5:53 PM, Jason Lincoln jlincoln@yahoo.com wrote:
It’s the response that is sent to the Alexa service that I have in my prior email. It should look like normal JSON. In app.rb I call the AlexaRubykit as shown below.
response = AlexaRubykit::Response.new response.add_speech('Ruby is running ready!’); puts response.build_response
The std out shows the expected JSON but when the index.js grabs the stdout and pushes it to the context.succeed the escape characters are added as previously shown and the Alexa service doesn’t recognize it as a valid response.
I tried removing the std out from the equation by using a /tmp/alexa_response.txt file. I write to in the app.rb and read it in the index.js. The same thing happens. The quotes are escaped in the resulting value.
It’s down to this one obstacle.
Thanks, Jason
On Mar 20, 2016, at 10:36 AM, Loren Norman <notifications@github.com mailto:notifications@github.com> wrote:
I would need to see the Alexa code that is failing, it seems like you're handing it the string with escape characters in it directly, when I would expect you to call JSON.parse on it first to get a real object to pass around.
On Sat, Mar 19, 2016 at 10:42 PM, Jason <notifications@github.com mailto:notifications@github.com> wrote:
Thank you for the link. I was able to pass the event and context parameter values over to the app.rb from the index.js through the app bash script.
Getting the value from the app.rb back is not quite working though. It’s coming out with escape characters that pose a problem to the Alexa service. It doesn’t look valid to the Alexa service.
"{\"version\":\"1.0\",\"response\":{\"outputSpeech\":{\"type\":\"PlainText\",\"text\":\"Ruby is running ready!\"},\"shouldEndSession\":true}}\n"
I need to find a way for it to return as:
{"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Ruby is running ready!"},"shouldEndSession":true}}
Here is the index.js script.
var spawn = require('child_process').spawn;
var invokeRubyApp = "./app";
exports.handler = function(event, context) { var result = ''; console.log("Starting process: " + invokeRubyApp); // console.log("event is " + JSON.stringify(event, null, 2)); // console.log("context is " + JSON.stringify(context, null, 2)); var child = spawn(invokeRubyApp, [JSON.stringify(event, null, 2), JSON.stringify(context, null, 2)]);
child.stdout.on('data', function (data) { console.log("stdout:\n"+data); result += data; }); child.stderr.on('data', function (data) { console.log("stderr:\n"+data); });
child.on('close', function (code) { if (code === 0) { // context.succeed("Process completed: " + invokeRubyApp); console.log("result is " + result); // context.succeed("Process completed: " + invokeRubyApp); context.succeed(result); } else { context.fail("Process \"" + invokeRubyApp + "\" exited with code: " + code); } }); }
Here is the wrapper.sh bash script that passes the event $1 and context $2 over to the app.rb script.
!/bin/bash
set -e
Figure out where this script is located.
SELFDIR="
dirname \"$0\"
" SELFDIR="cd \"$SELFDIR\" && pwd
"Tell Bundler where the Gemfile and gems are.
export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile" unset BUNDLE_IGNORE_CONFIG
Run the actual app using the bundled Ruby interpreter, with Bundler
activated.
echo "Param 1 is " $1
echo "Param 2 is " $2
exec "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/app.rb" "$1" "$2"
Jason
On Mar 19, 2016, at 5:37 PM, Loren Norman <notifications@github.com mailto:notifications@github.com> wrote:
No idea, but you might also look here: https://github.com/qrush/lambda-function-wrapper-ruby https://github.com/qrush/lambda-function-wrapper-ruby
...and he has resources in his README as well.
On Sat, Mar 19, 2016 at 9:07 AM, Jason <notifications@github.com mailto:notifications@github.com> wrote:
I’m trying.
I’m looking at getting the event and context passed over from index.js to the app shell script and then over to the app.rb script. That’s not already there, is it?
Thanks, Jason
On Mar 19, 2016, at 7:56 AM, Loren Norman <notifications@github.com mailto:notifications@github.com> wrote:
Awesome! Now teach Alexa some new skills!
On Saturday, March 19, 2016, Jason <notifications@github.com mailto:notifications@github.com> wrote:
Closed #4 <https://github.com/lorennorman/ruby-on-lambda/issues/4 https://github.com/lorennorman/ruby-on-lambda/issues/4 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969 https://github.com/lorennorman/ruby-on-lambda/issues/4#event-595836969
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub <
https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561 https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198697561
— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122 https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198700122
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub < https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198801219 https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198801219
— You are receiving this because you commented. Reply to this email directly or view it on GitHub <https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198834760 https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198834760>
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-198950882
OK cool, I am just reading along and seeing if I can help, I think I see your problem. That result
var that you're building up in JavaScript is just a string. It happens to contain data that could be parsed into a proper JS object (which is like a Ruby Hash), but it's just a string as you've created it.
When I read the API doc (or whatever this is) for the context.succeed
method here (http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html) I see that it expects an object.
All of this is to say that you need to JSON.parse your string into an object before calling that method.
On the line where you do:
context.succeed(result);
It should be:
resultObject = JSON.parse(result);
context.succeed(resultObject);
Again I haven't tried any of this, just really excited to write a Ruby-Lambda-AlexaSkill sometime soon!
You did it!
Thank you very much.
Now I can work on a skill using my favorite language.
Jason
On Mar 20, 2016, at 6:47 PM, Loren Norman notifications@github.com wrote:
OK cool, I am just reading along and seeing if I can help, I think I see your problem. That result var that you're building up in JavaScript is just a string. It happens to contain data that could be parsed into a proper JS object (which is like a Ruby Hash), but it's just a string as you've created it.
When I read the API doc (or whatever this is) for the context.succeed method here (http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html) I see that it expects an object.
All of this is to say that you need to JSON.parse your string into an object before calling that method.
On the line where you do:
context.succeed(result); It should be:
resultObject = JSON.parse(result); context.succeed(resultObject); Again I haven't tried any of this, just really excited to write a Ruby-Lambda-AlexaSkill sometime soon!
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/lorennorman/ruby-on-lambda/issues/4#issuecomment-199061047
After bundling alexa_rubykit using
bundle _1.9.9_ install
and deploying I receive the following error stack when testing.START RequestId: 7807580e-edc7-11e5-8d3b-710695bfba94 Version: $LATEST 2016-03-19T11:41:07.709Z 7807580e-edc7-11e5-8d3b-710695bfba94 Starting process: ./app 2016-03-19T11:41:11.353Z 7807580e-edc7-11e5-8d3b-710695bfba94 stderr: /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/spec_set.rb:92:in
block in materialize': Could not find rake-10.5.0 in any of the sources (Bundler::GemNotFound) from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:in
map!' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/spec_set.rb:85:inmaterialize' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/definition.rb:132:in
specs' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/definition.rb:177:inspecs_for' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/definition.rb:166:in
requested_specs' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/environment.rb:18:inrequested_specs' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/runtime.rb:13:in
setup' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler.rb:122:insetup' from /var/task/lib/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.7.12/lib/bundler/setup.rb:17:in
<top (required)>' from /var/task/lib/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:inrequire' from /var/task/lib/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in
rescue in require' from /var/task/lib/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'2016-03-19T11:41:11.492Z 7807580e-edc7-11e5-8d3b-710695bfba94 {"errorMessage":"Process \"./app\" exited with code: 1"} END RequestId: 7807580e-edc7-11e5-8d3b-710695bfba94 REPORT RequestId: 7807580e-edc7-11e5-8d3b-710695bfba94 Duration: 3789.30 ms Billed Duration: 3800 ms Memory Size: 128 MB Max Memory Used: 24 MB
I see rake in the deployment zip file. I just don't know why AWS lambda isn't seeing it.