MS GRAPH Error Operation: Create; Exception: Status Code: InternalServerError; Reason: The operation failed with an unexpected error: 1 when setting up rich notifications

Tony Connell 20 Reputation points
2023-11-27T13:14:48.2833333+00:00

I get the following error when trying to set up a rich notification subscription for events and messages

statusCode: 500,
  code: 'ExtensionError',
  requestId: 'fc9e0ae6-eae4-45d2-9599-1dc867030486',
  date: 2023-11-27T12:45:48.000Z,
  body: '{"code":"ExtensionError","message":"Operation: Create; Exception: [Status Code: InternalServerError; Reason: The operation failed with an unexpected error: 1.]","innerError":{"date":"2023-11-27T12:45:48","request-id":"fc9e0ae6-eae4-45d2-9599-1dc867030486","client-request-id":"b0edad5f-7c73-11ed-4ae8-8e80630b8f80"}}',
  headers: HeadersList {
    [Symbol(headers map)]: Map(10) {
      'cache-control' => [Object],
      'transfer-encoding' => [Object],
      'content-type' => [Object],
      'content-encoding' => [Object],
      'vary' => [Object],
      'strict-transport-security' => [Object],
      'request-id' => [Object],
      'client-request-id' => [Object],
      'x-ms-ags-diagnostic' => [Object],
      'date' => [Object]
    },
    [Symbol(headers map sorted)]: null
  }

This occurs both through postman and using the @microsoft/microsoft-graph-client in node

I can successfully access the same resources and can also sucessfully create a non rich notification on the same user for the same resources so I dont think it is a permissions issue.

so this payload creates the error

     const payload = {
          changeType: 'created,updated,deleted', // triggers in lifecycle notification
          notificationUrl: process.env.MS_WH_NOTIFICATION_URL,
          lifecycleNotificationUrl: process.env.MS_WH_LIFECYCLE_NOTIFICATION_URL,
          includeResourceData: true,
          encryptionCertificate: certificate,
          encryptionCertificateId: secretName,
          resource: '/users/'+ subscription.oid +'/events?$select=id',
          expirationDateTime: new Date(Date.now() + 20000),
          clientState: subscription.oid,
        }

whereas this payload works

     const payload = {
          changeType: 'created,updated,deleted', // triggers in lifecycle notification
          notificationUrl: process.env.MS_WH_NOTIFICATION_URL,
          lifecycleNotificationUrl: process.env.MS_WH_LIFECYCLE_NOTIFICATION_URL,
          resource: '/users/'+ subscription.oid +'/events?$select=id',
        	resource: '/users/'+ subscription.oid +'/events',
          expirationDateTime: new Date(Date.now() + 20000),
          clientState: subscription.oid,
        }

in both scenarios i get and return the validation requests to the endpoint and return a 200
I have also checked that my certificate is base64 encoded correctly.

I am connecting to the v1 version of graph but get the same result using beta so not sure what else to try as the error message doesn't help at all. This is a real blocker so would really appreciate any help.

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,418 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Panik 0 Reputation points
    2024-01-04T00:27:35.0333333+00:00

    Did you ever figure anything out here? I'm having 100% to a T the exact same issue and I'm just completely stuck. Desperate for help.

    0 comments No comments

  2. Koen Reefman 0 Reputation points
    2024-01-11T12:41:34.1433333+00:00

    I had the same issue, it appears I was using a wrong (format) certificate. The value supplied for encryptionCertificate must be the base64 certificate only, meaning when you export a certifcate as base64, copy only the parts between
    -----BEGIN CERTIFICATE-----
    and
    -----END CERTIFICATE-----
    and remove linebreaks.

    0 comments No comments

  3. André Viviers 0 Reputation points
    2024-01-31T14:22:12.8+00:00

    I am having the exact same issue.

    I have found that when using a self signed certificate, the subscription seems to be working. However as soon as i use a trusted cert from the keychain it does not work.

    The trusted cert that I am making use works when subscribing to "communications/presences" but does not when subscribing to users/{uri}/events

    Have you found a solution for this?

    0 comments No comments