Announcement: The Alexa Skills Community Is Moving To Stack Overflow

For improved usability and experience, Alexa skills related forum support will be transitioned to Stack Overflow. Effective January 10, 2024, the Amazon Developer Forums will no longer be available. For continued Alexa skills support you can reach out to us on Stack Overflow or via Contact Us.

question

cdburns123 avatar image
cdburns123 asked

Proxy, Code, Where does it all go?

I am attempting a proxy setup. Here is the error I am getting when I try to test it on Lambda Functions Test page: { "errorMessage": "Process exited before completing request" } -and- ReferenceError: https is not defined at exports.handler Having issues as to where to put what. I have this in my Code Tab on AWS Console...not sure if I am even suppose to have this here since I am wanting to forward the request to my httplistener on my own web server: ******************************** CODE TAB ************************** var http = require("http"); var options = { host: "http:// My outside Website", // global IP goes here. I've tried a DDNS host and the address of my server port: 8080, method: 'POST', headers: { 'Content-Type': 'text' } }; var data = 'OFF'; exports.handler = function(event, context) { var req = https.request(options, function(res) { var body = ''; console.log('Status:', res.statusCode); console.log('Headers:', JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function(chunk) { body += chunk; }); res.on('end', function() { console.log('Successfully processed HTTPS response'); // If we know it's JSON, parse it if (res.headers['content-type'] === 'application/json') { body = JSON.parse(body); } context.succeed(body); }); }); console.log("Before the error"); req.on('error', context.fail); req.write(data); console.log("Before req.end()"); req.end(); }; *************************************** END CODE TAB ************************************** INDEX.js FILE********************************** var https = require("https"); var MyApplicationId = " amzn1.echo-sdk-ams.app.My app ID here"; // change to your ApplicationId var MyEndpoint = "https:// My outside website"; // change to your Endpont exports.handler = function (event, context) { try { console.log("event=" + JSON.stringify(event)); /** * 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 === MyApplicationId) ; // from Echo else if (event.session.application.applicationId === "amzn1.echo-sdk-ams.app. MY application ID here") ; // from Amazon Lambda Test ... or intruder else context.fail("Invalid Application ID"); console.log("new:" + event.session.new); if (event.session.new) { onSessionStarted({ requestId: event.request.requestId }, event.session, function callback(sessionAttributes, speechletResponse) { console.log("new: speechletResponse:" + speechletResponse); }); } -------------------etc....... Then I have an HTML file with: // The path is correct. My C# code states it is listening Been at this for a while now, so if anyone can point me in the right direction...I would GREATLY appreciate it. Thanks,
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

cdburns123 avatar image
cdburns123 answered
Never Mind all....got it.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.