From e0fb0fa92d9e73b24a16d3823df4faa71ad22e59 Mon Sep 17 00:00:00 2001 From: Vigneshwaran Kannan Date: Wed, 17 Jun 2026 15:08:47 +0530 Subject: [PATCH 1/2] [21143] Fix ServiceNow MCP Tool Bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: servicenow-get-current-user action crashes with TypeError: this.servicenow.baseUrl is not a function Summary The ServiceNow MCP tool servicenow-get-current-user (action version 0.0.1) fails on every invocation with a TypeError, before any network call is made. All other ServiceNow actions work fine on the same connected account. Root cause: The action called this.servicenow.baseUrl() and this.servicenow.authHeaders() — neither of which exist on the published servicenow.app.mjs. The app only exposes _makeRequest(), which handles auth and the base URL internally. Fix: The action now uses the same _makeRequest pattern as every other working ServiceNow action (e.g., search-records-by-keyword), eliminating the TypeError on every invocation. Version bumped 0.0.1 → 0.0.2, package 0.10.1 → 0.10.2. --- .../get-current-user/get-current-user.mjs | 20 +++++++++---------- components/servicenow/package.json | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/components/servicenow/actions/get-current-user/get-current-user.mjs b/components/servicenow/actions/get-current-user/get-current-user.mjs index 7eef885e3b473..84664d37dbd09 100644 --- a/components/servicenow/actions/get-current-user/get-current-user.mjs +++ b/components/servicenow/actions/get-current-user/get-current-user.mjs @@ -1,11 +1,10 @@ -import { axios } from "@pipedream/platform"; import servicenow from "../../servicenow.app.mjs"; export default { key: "servicenow-get-current-user", name: "Get Current User", description: "Returns the authenticated ServiceNow user's sys_id, name, email, username, and instance URL. Call this first when the user says 'my incidents', 'my cases', 'assigned to me', or needs their ServiceNow identity. Use `sys_id` to filter records in **Get Table Records** (e.g. `assigned_to={sys_id}`) or **Create Table Record**. [See the documentation](https://docs.servicenow.com/bundle/vancouver-api-reference/page/integrate/inbound-rest/concept/c_TableAPI.html).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, @@ -16,31 +15,30 @@ export default { servicenow, }, async run({ $ }) { - const sessionInfo = await axios($, { - url: `${this.servicenow.baseUrl()}/api/now/ui/user/current_user`, - headers: this.servicenow.authHeaders(), + const sessionInfo = await this.servicenow._makeRequest({ + $, + url: "/ui/user/current_user", }); - const userSysId = sessionInfo.result?.user_sys_id; + const userSysId = sessionInfo?.result?.sys_id; if (!userSysId) { throw new Error("Unable to determine current user from session"); } - const userResponse = await axios($, { - url: `${this.servicenow.baseUrl()}/api/now/table/sys_user/${userSysId}`, - headers: this.servicenow.authHeaders(), + const user = await this.servicenow._makeRequest({ + $, + url: `/table/sys_user/${userSysId}`, params: { sysparm_fields: "sys_id,user_name,name,email,title,department,location", }, }); - const user = userResponse.result; const summaryName = user.name || user.user_name || user.sys_id; $.export("$summary", `Retrieved user ${summaryName}`); return { - instance_url: this.servicenow.baseUrl(), + instance_url: `https://${this.servicenow.$auth.instance_name}.service-now.com`, sys_id: user.sys_id, user_name: user.user_name, name: user.name, diff --git a/components/servicenow/package.json b/components/servicenow/package.json index d7c563af8dc43..6fc849bbc518c 100644 --- a/components/servicenow/package.json +++ b/components/servicenow/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/servicenow", - "version": "0.10.1", + "version": "0.10.2", "description": "Pipedream ServiceNow Components", "main": "servicenow.app.mjs", "keywords": [ From 87dda4605ac9ffbbc3a707f6d9b562f886a8c81e Mon Sep 17 00:00:00 2001 From: Vigneshwaran Kannan Date: Tue, 23 Jun 2026 11:43:12 +0530 Subject: [PATCH 2/2] changes with respect to review changes with respect to review --- .../servicenow/actions/get-current-user/get-current-user.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/servicenow/actions/get-current-user/get-current-user.mjs b/components/servicenow/actions/get-current-user/get-current-user.mjs index 84664d37dbd09..91cbb0edd020f 100644 --- a/components/servicenow/actions/get-current-user/get-current-user.mjs +++ b/components/servicenow/actions/get-current-user/get-current-user.mjs @@ -20,7 +20,7 @@ export default { url: "/ui/user/current_user", }); - const userSysId = sessionInfo?.result?.sys_id; + const userSysId = sessionInfo?.sys_id; if (!userSysId) { throw new Error("Unable to determine current user from session");