alexa / alexa-apis-for-nodejs

The Alexa APIs for NodeJS consists of JS and Typescript definitions that represent the request and response JSON of Alexa services. These models act as core dependency for the Alexa Skills Kit NodeJS SDK (https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs).
Apache License 2.0
60 stars 35 forks source link

Runtime.UnhandledPromiseRejection is raised when createReminder is called #18

Closed maito1201 closed 2 years ago

maito1201 commented 3 years ago

Recently, in most cases, the following error has started to occur, when I called ReminderManagementServiceClient.createReminder.

Unhandled Promise Rejection

The content of resolved promise is below.

ERROR   Unhandled Promise Rejection 
{
    "errorType": "Runtime.UnhandledPromiseRejection",
    "errorMessage": "ServiceError: Internal Server Error",
    "reason": {
        "errorType": "ServiceError",
        "errorMessage": "Internal Server Error",
        "name": "ServiceError",
        "statusCode": 500,
        "response": "<!doctype html><html lang=\"en\"><head><title>HTTP Status 500 – Internal Server Error</title><style type=\"text/css\">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class=\"line\" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Servlet execution threw an exception</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>javax.servlet.ServletException: Servlet execution threw an exception\n\tcom.amazon.arest.metrics.ARestQuerylogFilter.doFilter(ARestQuerylogFilter.java:58)\n</pre><p><b>Root Cause</b></p><pre>java.lang.NoSuchMethodError: com.fasterxml.jackson.jaxrs.cfg.AnnotationBundleKey.&lt;init&gt;([Ljava&#47;lang&#47;annotation&#47;Annotation;)V\n\torg.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider$ClassAnnotationKey.&lt;init&gt;(ResteasyJackson2Provider.java:67)\n\torg.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider$ClassAnnotationKey.&lt;init&gt;(ResteasyJackson2Provider.java:59)\n\torg.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:101)\n\torg.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59)\n\torg.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:62)\n\torg.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:51)\n\torg.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)\n\torg.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)\n\torg.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:150)\n\torg.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:89)\n\torg.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:112)\n\torg.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)\n\torg.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)\n\torg.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237)\n\torg.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)\n\torg.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)\n\torg.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)\n\torg.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)\n\torg.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:791)\n\tcom.amazon.arest.metrics.ARestQuerylogFilter.doFilter(ARestQuerylogFilter.java:58)\n</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class=\"line\" /><h3>Apache Tomcat/9.0.46</h3></body></html>",
        "stack": [
            "ServiceError: Internal Server Error",
            "    at ReminderManagementServiceClient.<anonymous> (/var/task/node_modules/ask-sdk-model/index.js:219:35)",
            "    at step (/var/task/node_modules/ask-sdk-model/index.js:45:23)",
            "    at Object.next (/var/task/node_modules/ask-sdk-model/index.js:26:53)",
            "    at fulfilled (/var/task/node_modules/ask-sdk-model/index.js:17:58)",
            "    at process._tickCallback (internal/process/next_tick.js:68:7)"
        ]
    },
    "promise": {},
    "stack": [
        "Runtime.UnhandledPromiseRejection: ServiceError: Internal Server Error",
        "    at process.on (/var/runtime/index.js:37:15)",
        "    at process.emit (events.js:198:13)",
        "    at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)",
        "    at process._tickCallback (internal/process/next_tick.js:69:34)"
    ]
}

Create Request sometimes succeeds.

related implement is below.

const client = handlerInput.serviceClientFactory.getReminderManagementServiceClient();
const time = currentIntent.slots.Time;
const t = luxon.DateTime.fromISO(time.value, { zone: userTimezone }).toFormat("yyyy-MM-dd'T'T:00");
const reminderRequest = buildReminderRequest(t, "title");
const reminderResponse = client.createReminder(reminderRequest);
reminderResponse.then((resp) => {
        console.log(resp);
 })

function buildReminderRequest(time, title) {
    return  {
        trigger: {
            "type" : "SCHEDULED_ABSOLUTE",
                    "scheduledTime" : time
            },
            alertInfo: {
                spokenInfo: {
                    content: [{
                        text: title,
                    }],
                },
            },
            pushNotification: {
                status: 'ENABLED',
            },
        };
}

version

dependencies in package.json is below

  "dependencies": {
    "ask-sdk-core": "^2.7.0",
    "ask-sdk-model": "^1.19.0",
    "aws-sdk": "^2.326.0"
  }
rahulawl commented 2 years ago

Hi @maito1201 . Are you still facing this issue? We will be closing the issue due to lack of activity. Please re-open if the issue is still prevalent.

rahulawl commented 2 years ago

We are closing the issue due to lack of activity. Please re-open if the issue is still prevalent.