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
I've been working on implementing Microsoft Graph webhook subscriptions in my application, and I've run into an issue with subscription validation. Whenever I attempt to validate the subscription, I've consistently receive the following error message:
Endpoint is accessible on the internet with unauthenticated invocation
Endpoint is returning 200OK, text-plain, decoded validationToken as intended
Endpoint able to reply within 10s timeframe consistently
However, when I actually attempt to create subscription request using MicrosoftGraph Javascript SDK, the validation request always faces timeout issue despite it being accessible via PostMan.
GraphError: Subscription validation request timed out.
at new GraphError (/code/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphError.js:34:28)
at GraphErrorHandler.constructErrorFromResponse (/code/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphErrorHandler.js:63:22)
at Function.<anonymous> (/code/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphErrorHandler.js:91:48)
at step (/code/node_modules/tslib/tslib.js:195:27)
at Object.next (/code/node_modules/tslib/tslib.js:176:57)
at /code/node_modules/tslib/tslib.js:169:75
at new Promise (<anonymous>)
at Object.__awaiter (/code/node_modules/tslib/tslib.js:165:16)
at GraphErrorHandler.getError (/code/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphErrorHandler.js:87:24)
at GraphRequest.<anonymous> (/code/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphRequest.js:315:84) {
statusCode: 400,
code: 'InvalidRequest',
requestId: 'uuid,
date: 2023-09-30T21:36:48.000Z,
body: '{"code":"InvalidRequest","message":"Subscription validation request timed out.","innerError":{"date":"2023-10-01T05:36:48","request-id":"uuid,"client-request-id":"uuid}}',
headers: HeadersList {
cookies: null,
[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
}
}
Code Snippet to Listen for Subscription Validation
import{FastifyPluginAsyncTypebox}from"@fastify/type-provider-typebox";import{Type}from"@sinclair/typebox";exportconstParamsSchema=Type.Object({fid: Type.String(),});exportconstQuerySchema=Type.Object({workspaceId: Type.RegEx(/^[0-9a-z]{25}$/),validationToken: Type.Optional(Type.String()),});constmain: FastifyPluginAsyncTypebox=async(app,options): Promise<void>=>{/** * Listens to changes to a folder */app.post("/",{schema: {params: ParamsSchema,querystring: QuerySchema}},async(req,rep)=>{app.log.info("Received webhook request");// If there is a validationToken parameter// in the query string, this is the endpoint validation// request sent by Microsoft Graph. Return the token// as plain text with a 200 response// https://docs.microsoft.com/graph/webhooks#notification-endpoint-validation// https://github.com/microsoftgraph/nodejs-webhooks-sample/blob/main/routes/listen.js#L13if(req.query.validationToken){returnreq.query.validationToken;}// Other logic but is commentedreturn{};});}
Screenshots: [If applicable, add screenshots to help explain your problem]
Logs from Google Cloud Console
Usage Information
Request ID - Value of the requestId field if you are receiving a Graph API error response
SDK Version - 3.0.7
Node (Check, if using Node version of SDK)
Node Version - v18.17.1
I'm unsure why the validation request fails in my application but works with Postman. Can anyone offer guidance on what could be causing this issue or suggest potential solutions?
The text was updated successfully, but these errors were encountered:
That's a good question. Can you run it locally via Dev Tunnels or ngrok? Can you create your subscription via Postman vs. just calling your validation endpoint? This would also be helpful. Thanks!
Bug Report
Prerequisites
For more information, see the
CONTRIBUTING
guide.Description
I've been working on implementing Microsoft Graph webhook subscriptions in my application, and I've run into an issue with subscription validation. Whenever I attempt to validate the subscription, I've consistently receive the following error message:
GraphError: Subscription validation request timed out.
My subscription server is deployed and hosted on Google Cloud Function v2, allowing all unauthenticated invocations.
The following verification is performed using Microsoft's Postman Collection:
However, when I actually attempt to create subscription request using MicrosoftGraph Javascript SDK, the validation request always faces timeout issue despite it being accessible via PostMan.
Code Snippet to Invoke Subscription Request
Console Errors:
Code Snippet to Listen for Subscription Validation
Screenshots: [If applicable, add screenshots to help explain your problem]
Logs from Google Cloud Console
Usage Information
Request ID - Value of the
requestId
field if you are receiving a Graph API error responseSDK Version - 3.0.7
I'm unsure why the validation request fails in my application but works with Postman. Can anyone offer guidance on what could be causing this issue or suggest potential solutions?
The text was updated successfully, but these errors were encountered: