Comments (4)
@jankoenig @aswetlow This is an issue on a big project I'm working on now.
from jovo-framework.
@rmtuckerphx we won't be able to deploy new v3
releases over the next 2 weeks. The fastest way to solve this is probably to patch this yourself
from jovo-framework.
@jankoenig I'm not sure what I would do to patch this.
Would that require me changing my code to not use whatever Jovo code calls server.ts?
What files would that be exactly?
I understand if this needs to wait. I'll do what I can to get a temporary exemption.
from jovo-framework.
Hi @rmtuckerphx,
Here is the code snippet provided by @aswetlow in Slack. It needs this workaround because alexa-verifier-middleware
doesn't support require()
at all.
'use strict';
const { ExpressJS, Lambda, Webhook } = require('jovo-framework');
const { app } = require('./app.js');
const fs = require('fs');
const bodyParser = require("body-parser");
const express = require("express");
const http = require("http");
const https = require("https");
// ------------------------------------------------------------------
// HOST CONFIGURATION
// ------------------------------------------------------------------
const verifiedServer = express();
verifiedServer.jovoApp = undefined;
verifiedServer.ssl = undefined;
verifiedServer.ssl = {
key: fs.readFileSync('/etc/letsencrypt/live/<domain>/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/<domain>/fullchain.pem'),
};
(async function() {
const verifier = await ( await import('alexa-verifier-middleware')).default;
verifiedServer.listen = function () {
try {
if (verifiedServer.jovoApp) {
verifiedServer.jovoApp.initWebhook();
}
const router = express.Router();
verifiedServer.use(router);
router.use('/webhook_alexa', verifier);
router.use('/webhook_alexa', bodyParser.json());
router.use('/webhook', bodyParser.json());
const httpServer = verifiedServer.ssl
? https.createServer(verifiedServer.ssl, this)
: http.createServer(this);
// @ts-ignore
return httpServer.listen.apply(httpServer, arguments); // eslint-disable-line
} catch (error) {
console.log(error);
}
};
// ExpressJS (Jovo Webhook)
if (process.argv.indexOf('--webhook') > -1) {
const port = process.env.JOVO_PORT || 443;
verifiedServer.jovoApp = app;
verifiedServer.listen(port, () => {
console.info(`Local server listening on port ${port}.`);
});
// Use this
verifiedServer.post(['/webhook','/webhook_alexa'], async (req, res) => {
await app.handle(new ExpressJS(req, res));
});
}
}());
from jovo-framework.
Related Issues (20)
- Delete Reminder not working HOT 2
- CanFulfillIntentRequest failed with version 4.3.1 HOT 2
- Unwanted Interaction between UNHANDLED, routing and order of component inclusion in app.ts HOT 7
- Quick replies are set in the wrong directive on Alexa
- Jovo 4.5.0 Error in JovoDebugger dependency makes it unusable HOT 2
- Dependency Injection not working in AWS Lambda HOT 5
- Update jovo-db-mongodb v3 from mongodb:3.7.3 to mongodb:4.12.1 HOT 1
- Error using audioplayer events with UNHANDLED function in GlobalComponent HOT 2
- Error: Missing required argument #1 HOT 1
- Don't require package-lock.json HOT 1
- Jovo Debugger stopped showing $output HOT 1
- How to implement in a easy way a custom platform? HOT 1
- Cannot initialize Custom Platform. The custom platform is not seen as extended class of Plugin HOT 2
- [BUG] Initializing the TestSuite Class in the test file, create a wrong sourcemap to jest. (Show the wrong error line in the error log) HOT 3
- LexSlu Plugin: Expose LexRuntimeV2ClientConfig as libraryConfig and make it optional
- Deploying to Alexa fails with headers.find is not a function HOT 4
- Cannot convert undefined or null to object while building project files for Alexa HOT 1
- SpeechRecognizer doesn't support enabled: false
- Add type checking to resolve object
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 jovo-framework.