jbergant / Chatbot-for-Website-with-React

Chatbot for Website with React
55 stars 71 forks source link

[QUESTION] S4-005-Text-query-to-DialogFlow-with-Async-await #14

Open aless10 opened 4 years ago

aless10 commented 4 years ago

Hi Jana, I'm not very familiar with async-await, but to it looks like you miss the error handling when you refactored the code to use async await in this commit https://github.com/jbergant/Chatbot-for-Website-with-React/commit/145bdcb9c5400229326f10815ff88b00d0c5e671

I think that in order to have the same piece of code, the code "await" call should be wrapped in a try/catch block like

try {
  const responses = await sessionClient.detectIntent(request)
  res.send(responses[0].queryResult)
} catch {
    console.error('ERROR:', err);
   // send something
}

Thanks for the course. I'm enjoying it.

eromose-le commented 4 years ago

I resolved mine using this const asyncHandler = require('express-async-handler'); app.post("/api/df_text_query", asyncHandler(async (req, res) => { let responses = await chatbot.textQuery(req.body.text, req.body.parameters); res.send(responses[0].queryResult); }));

But after I resolved it, I am stucked with this error on my log.

2020-09-15T23:49:04.360834+00:00 app[web.1]: Error: ERR_OSSL_PEM_NO_START_LINE undefined: Getting metadata from plugin failed with error: error:0909006C:PEM routines:get_name:no start line

I also get Internal Server Error when testing the API post with SERVISTATE.

Please help me.

orestkozolup commented 3 years ago

Hello @eromose-le, Have you managed to solve the issue with "no start line"? I'm currently facing it. Would appreciate a lot if you could help.