Skip to content

Commit

Permalink
SNOW-1801434-Add-GUID-to-request-in-NODE.js-driver: Rolled back to se…
Browse files Browse the repository at this point in the history
…tting includeGuid flag implicitly in preprocessRequestOptions
  • Loading branch information
sfc-gh-fpawlowski committed Dec 6, 2024
1 parent e23851b commit 31496c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 8 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,14 @@ declare module 'snowflake-sdk' {
*/
requestId?: string;

/**
* The request GUID is a unique identifier of an HTTP request issued to Snowflake.
* Unlike the requestId, it is regenerated even when the request is resend with the retry mechanism.
* If not specified, request GUIDs are attached to all requests to Snowflake for better traceability.
* In the majority of cases it should not be set or filled with true value.
*/
includeGuid?: string;

/**
* Use different rest endpoints based on whether the query id is available.
*/
Expand Down
6 changes: 2 additions & 4 deletions lib/services/sf.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ function SnowflakeService(connectionConfig, httpClient, config) {
* @constructor
*/
function OperationRequest(options) {
options = { ...options, ...{ includeGuid: true } };
OperationAbstract.apply(this, [options]);
}

Expand Down Expand Up @@ -787,6 +786,8 @@ function StateAbstract(options) {

// augment the options with the absolute url
requestOptions.absoluteUrl = this.buildFullUrl(requestOptions.url);

requestOptions.includeGuid = Util.exists(requestOptions.includeGuid) ? requestOptions.includeGuid : true;
};

/**
Expand Down Expand Up @@ -1253,7 +1254,6 @@ StateConnecting.prototype.continue = function () {
scope: this,
startTime: startTime,
retry: numRetries,
includeGuid: true,
callback: requestCallback
});
request.send();
Expand Down Expand Up @@ -1409,7 +1409,6 @@ StateConnected.prototype.destroy = function (options) {
method: 'POST',
url: `/session?delete=true&requestId=${requestID}`,
scope: this,
includeGuid: true,
callback: function (err) {
// if the destroy request succeeded or the session already expired, we're disconnected
if (!err || err.code === GSErrors.code.GONE_SESSION || err.code === GSErrors.code.SESSION_TOKEN_EXPIRED) {
Expand Down Expand Up @@ -1450,7 +1449,6 @@ StateRenewing.prototype.enter = function () {
'REQUEST_TYPE': 'RENEW',
'oldSessionToken': this.tokenInfo.getSessionToken(),
},
includeGuid: true,
scope: this,
callback: function (err, body) {
// if the request succeeded
Expand Down

0 comments on commit 31496c8

Please sign in to comment.