Skip to content

Commit

Permalink
Merge branch 'main' into fix/error-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Fernández committed Nov 22, 2022
2 parents 3d0b4e3 + f680171 commit e96216d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
}
},
"dependencies": {
"@prisma/engines-version": "4.7.0-44.13aac41f99aacedd4786208ed0b9dabcfa7493b8"
"@prisma/engines-version": "4.7.0-47.ff00e0ed8be197c2d168ee7dd9e70867c6fd55a9"
},
"sideEffects": false
}
13 changes: 12 additions & 1 deletion packages/engine-core/src/binary/BinaryEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import type {
} from '../common/types/QueryEngine'
import type * as Tx from '../common/types/Transaction'
import { printGeneratorConfig } from '../common/utils/printGeneratorConfig'
import { runtimeHeadersToHttpHeaders } from '../common/utils/runtimeHeadersToHttpHeaders'
import { fixBinaryTargets, plusX } from '../common/utils/util'
import byline from '../tools/byline'
import { omit } from '../tools/omit'
Expand Down Expand Up @@ -1216,6 +1215,18 @@ function stringifyQuery(q: string) {
return `{"variables":{},"query":${JSON.stringify(q)}}`
}

/**
* Convert runtime headers to HTTP headers expected by the Query Engine.
*/
function runtimeHeadersToHttpHeaders(headers: QueryEngineRequestHeaders): Record<string, string | undefined> {
if (headers.transactionId) {
const { transactionId, ...httpHeaders } = headers
httpHeaders['X-transaction-id'] = transactionId
return httpHeaders
}
return headers
}

function hookProcess(handler: string, exit = false) {
process.once(handler as any, async () => {
for (const engine of engines) {
Expand Down

This file was deleted.

13 changes: 12 additions & 1 deletion packages/engine-core/src/data-proxy/DataProxyEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { EventEmitter } from '../common/types/Events'
import { EngineMetricsOptions, Metrics, MetricsOptionsJson, MetricsOptionsPrometheus } from '../common/types/Metrics'
import { QueryEngineBatchRequest, QueryEngineRequestHeaders, QueryEngineResult } from '../common/types/QueryEngine'
import type * as Tx from '../common/types/Transaction'
import { runtimeHeadersToHttpHeaders } from '../common/utils/runtimeHeadersToHttpHeaders'
import { DataProxyError } from './errors/DataProxyError'
import { ForcedRetryError } from './errors/ForcedRetryError'
import { InvalidDatasourceError } from './errors/InvalidDatasourceError'
Expand Down Expand Up @@ -419,3 +418,15 @@ export class DataProxyEngine extends Engine {
}
}
}

/**
* Convert runtime headers to HTTP headers expected by the Data Proxy by removing the transactionId runtime header.
*/
function runtimeHeadersToHttpHeaders(headers: QueryEngineRequestHeaders): Record<string, string | undefined> {
if (headers.transactionId) {
const httpHeaders = { ...headers }
delete httpHeaders.transactionId
return httpHeaders
}
return headers
}
2 changes: 1 addition & 1 deletion packages/engines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Tim Suchanek <suchanek@prisma.io>",
"devDependencies": {
"@prisma/debug": "workspace:*",
"@prisma/engines-version": "4.7.0-44.13aac41f99aacedd4786208ed0b9dabcfa7493b8",
"@prisma/engines-version": "4.7.0-47.ff00e0ed8be197c2d168ee7dd9e70867c6fd55a9",
"@prisma/fetch-engine": "workspace:*",
"@prisma/get-platform": "workspace:*",
"@swc/core": "1.3.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetch-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"bugs": "https://github.com/prisma/prisma/issues",
"enginesOverride": {},
"devDependencies": {
"@prisma/engines-version": "4.7.0-44.13aac41f99aacedd4786208ed0b9dabcfa7493b8",
"@prisma/engines-version": "4.7.0-47.ff00e0ed8be197c2d168ee7dd9e70867c6fd55a9",
"@swc/core": "1.3.14",
"@swc/jest": "0.2.23",
"@types/jest": "28.1.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@prisma/fetch-engine": "workspace:*",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "workspace:*",
"@prisma/prisma-fmt-wasm": "4.7.0-44.13aac41f99aacedd4786208ed0b9dabcfa7493b8",
"@prisma/prisma-fmt-wasm": "4.7.0-47.ff00e0ed8be197c2d168ee7dd9e70867c6fd55a9",
"archiver": "5.3.1",
"arg": "5.0.2",
"chalk": "4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": "latest"
},
"devDependencies": {
"@prisma/engines-version": "4.7.0-44.13aac41f99aacedd4786208ed0b9dabcfa7493b8",
"@prisma/engines-version": "4.7.0-47.ff00e0ed8be197c2d168ee7dd9e70867c6fd55a9",
"@prisma/generator-helper": "workspace:*",
"@prisma/internals": "workspace:*",
"@swc/core": "1.3.14",
Expand Down
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e96216d

Please sign in to comment.