ide/hapi-async-handler

Failure with latest hapi, typescript etc.

Open

#13 geöffnet am 12. Dez. 2016

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (7 Forks)github user discovery
help wanted

Repository-Metriken

Stars
 (44 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

I get a fatal error if I combine hapi-async-handler (1.0.3) with hapi 16.0.1, asyncfile 2.0.2, node 7.0 and typescript 2.1. The process outputs the following and the request stalls.

(node:5494) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: text.replace is not a function (node:5494) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Example handler:

handler: async function (request: hapi.Request, reply: hapi.IReply) {
        let newsFile = Path.join(assets_folder, 'news.md');
        let input = await fs.readFile(newsFile);

        let converter = new showdown.Converter();
        let html = converter.makeHtml(input);
        reply(html);
      },

Contributor Guide