You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
The init method from class FacebookAdapter on package botbuilder-adapter-facebook (version 1.0.8) of botkit package receives a Botkit object as parameter and this object can have a property called disable_webserver used for informe the Botkit constructor that the webserver do not be created during the instantiation process.
constadapter=newFacebookAdapter({verify_token: process.env.FACEBOOK_VERIFY_TOKEN,app_secret: process.env.FACEBOOK_APP_SECRET,access_token: process.env.FACEBOOK_ACCESS_TOKEN});constcontroller=newBotkit({adapter: adapter,disable_webserver: true,// other options});
But when this object (Botkit) is sended to the init method from FacebookAdapter class this option is not considered and the init method try create a new get route to the default webhook. This action causes a error because is not possible call the get method from botkit.webserver, that is undefined.
public async init(botkit): Promise<any> {
debug('Add GET webhook endpoint for verification at: ', botkit.getConfig('webhook_uri'));
botkit.webserver.get(botkit.getConfig('webhook_uri'), (req, res) => {
if (req.query['hub.mode'] === 'subscribe') {
if (req.query['hub.verify_token'] === this.options.verify_token) {
res.send(req.query['hub.challenge']);
} else {
res.send('OK');
}
}
});
}
I am using this approach because I have an external web server used with Botkit in my project.
I beliave that this behavior may be modified if on the init method the disable_webserver config option was considered like the code bellow for example
init(botkit) {
return __awaiter(this, void 0, void 0, function* () {
// This condition is the modification
debug('disable_webserver: ', (botkit._config) ? botkit._config.disable_webserver: false);
if (botkit._config && !botkit._config.disable_webserver) {
debug('Add GET webhook endpoint for verification at: ', botkit.getConfig('webhook_uri'));
botkit.webserver.get(botkit.getConfig('webhook_uri'), (req, res) => {
if (req.query['hub.mode'] === 'subscribe') {
if (req.query['hub.verify_token'] === this.options.verify_token) {
res.send(req.query['hub.challenge']);
}
else {
res.send('OK');
}
}
});
}
});
}
This code may be modified on facebook_adapter.js on lib directory and on facebook_adapter.ts on *src directory.
What was the result you received?
I received a error on init method from facebookAdapter class because the code try access the get method form botkit.webserver and this parameter is undefined
What did you expect?
I expected that the botkit constructor was well initialized with the parameters adapter: facebookAdapter and disable_webserver: true, but i received a error when the init method of the facebookAdapter class was excecuted because the webserver associated with the botkit instances was undefined, as requested by disable_webserver parameter
Context:
botbuilder-adapter-facebook version: 1.0.8
Botkit version: 4.5.0
Messaging Platform: Facebook
Node version: 10.15.2
Os: Ubuntu Linux 18.04
Any other relevant information:
The text was updated successfully, but these errors were encountered:
The init method from class FacebookAdapter on package botbuilder-adapter-facebook (version 1.0.8) of botkit package receives a Botkit object as parameter and this object can have a property called disable_webserver used for informe the Botkit constructor that the webserver do not be created during the instantiation process.
But when this object (Botkit) is sended to the init method from FacebookAdapter class this option is not considered and the init method try create a new get route to the default webhook. This action causes a error because is not possible call the get method from botkit.webserver, that is undefined.
I am using this approach because I have an external web server used with Botkit in my project.
I beliave that this behavior may be modified if on the init method the disable_webserver config option was considered like the code bellow for example
This code may be modified on facebook_adapter.js on lib directory and on facebook_adapter.ts on *src directory.
What was the result you received?
I received a error on init method from facebookAdapter class because the code try access the get method form botkit.webserver and this parameter is undefined
What did you expect?
I expected that the botkit constructor was well initialized with the parameters adapter: facebookAdapter and disable_webserver: true, but i received a error when the init method of the facebookAdapter class was excecuted because the webserver associated with the botkit instances was undefined, as requested by disable_webserver parameter
Context:
The text was updated successfully, but these errors were encountered: