I’m working on an Alexa Skill which connects to an Airtable Base - https://glitch.com/edit/#!/gp-skill
The code works on my local machine using the alexa-app-server.
However, when I click show I get a 504 Gateway Time-out error, when I would expect to see things like the intent scheme and utterances. There’s no errors coming up on the console (and at one point, the console.log was full of the output of the utterances, but that’s not happening at the moment).
Any hints on where my code has gone wrong?
(And what I’m really trying to do is get past Amazon’s Service Simulator returning The remote endpoint could not be called, or the response it returned was invalid. And I’m guessing the 504 error is related.)
Solved - looking more closely at the Weather Forecast Skill I realised I hadn’t put in all the things to do with the test view using express and ejs.
Things are working now!
Actually, I do still have a question.
Why does the final line of index.js have to be
app.listen(PORT, () => console.log("Listening on port " + PORT + "."));
When the example I’m basing my skill on has as it’s final line
module.exports = app;
Without the app.listen line, nothing works. And I kind of get this - that line makes the server listen for requests. So I suppose the real question is, why isn’t it needed in that example? Is it something to do with how the node environment is setup differently on Glitch compared with Lambda?
In Lambda, the API gateway handles the connection. Your express app just needs to handle routing requests to the right handlers. In Glitch, your app needs to listen for connections too.
Thanks for the explanation @Tim. I’m very new to this kind of coding (and out of practice even with the coding I used to do) - but really enjoying getting my hands dirty again, especially with the very helpful community here at glitch.