Skip to content

Commit

Permalink
Merge pull request #17 from finsweet/fix-16
Browse files Browse the repository at this point in the history
fix: wrong firestore endpoint URL constructor
  • Loading branch information
alexiglesias93 authored Sep 19, 2023
2 parents c3382ad + 395d097 commit 45f77f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-suns-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'fireworkers': patch
---

fix: wrong firestore endpoint URL constructor
8 changes: 3 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ export const get_firestore_endpoint = (
paths: string[] = [],
suffix = ''
): URL => {
const path = paths.join('/') + suffix;
const endpoint = new URL(
path,
`${FIRESTORE_ENDPOINT}/v1/projects/${project_id}/databases/(default)/documents`
);
const allPaths = ['v1', 'projects', project_id, 'databases', '(default)', 'documents', ...paths];
const path = allPaths.join('/') + suffix;

const endpoint = new URL(path, FIRESTORE_ENDPOINT);
return endpoint;
};

0 comments on commit 45f77f4

Please sign in to comment.