Skip to content

Commit

Permalink
fix: passing authtoken only in http request
Browse files Browse the repository at this point in the history
  • Loading branch information
pffigueiredo committed Nov 22, 2024
1 parent 28c823d commit c50ed4e
Show file tree
Hide file tree
Showing 9 changed files with 424 additions and 416 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## UNRELEASED

Fixes only passing `authToken` in the `sql` HTTP request and not in the `neon` connection setup.

## 0.10.3 (2024-11-06)

Fixes `authToken` overriding in `sql` HTTP request.
Expand Down
268 changes: 134 additions & 134 deletions dist/jsr/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jsr/jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neon/serverless",
"version": "0.10.3",
"version": "0.10.4",
"exports": "./index.js",
"imports": {
"pg": "npm:@types/[email protected]"
Expand Down
4 changes: 4 additions & 0 deletions dist/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## UNRELEASED

Fixes only passing `authToken` in the `sql` HTTP request and not in the `neon` connection setup.

## 0.10.3 (2024-11-06)

Fixes `authToken` overriding in `sql` HTTP request.
Expand Down
272 changes: 136 additions & 136 deletions dist/npm/index.js

Large diffs are not rendered by default.

268 changes: 134 additions & 134 deletions dist/npm/index.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/npm/package-lock.json

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

2 changes: 1 addition & 1 deletion dist/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neondatabase/serverless",
"version": "0.10.3",
"version": "0.10.4",
"author": "Neon",
"description": "node-postgres for serverless environments from neon.tech",
"exports": {
Expand Down
16 changes: 8 additions & 8 deletions export/httpQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ export function neon(
) {
const { fetchEndpoint, fetchFunction } = Socket;

const url =
typeof fetchEndpoint === 'function'
? fetchEndpoint(hostname, port, {
jwtAuth: authToken !== undefined,
})
: fetchEndpoint;

const bodyData = Array.isArray(parameterizedQuery)
? { queries: parameterizedQuery }
: parameterizedQuery;
Expand Down Expand Up @@ -288,8 +281,15 @@ export function neon(
resolvedAuthToken = allSqlOpts.authToken;
}

// --- set headers ---
// --- set up the URL ---
const url =
typeof fetchEndpoint === 'function'
? fetchEndpoint(hostname, port, {
jwtAuth: resolvedAuthToken !== undefined,
})
: fetchEndpoint;

// --- set headers ---
const headers: Record<string, string> = {
'Neon-Connection-String': connectionString,
'Neon-Raw-Text-Output': 'true', // because we do our own parsing with node-postgres
Expand Down

0 comments on commit c50ed4e

Please sign in to comment.