electric-sql / electric-sql/electric

Feature request: allow relative paths when creating `ShapeStream`

Open
#3,693 0 comments 0 reactions 0 assignees View on GitHub
feature request triage
Dominant language
TypeScript
Stars
10.4k
Forks
375
Avg merge
3d 1h
Merged PRs (30d)
18

Description

**Is your feature request related to a problem? Please describe.**

When creating a ShapeStream in a browser client context, one can't use a relative path like this:

```typescript
const stream = new ShapeStream({
url: `/api/v1/shape`,
})
```

This fails because the URL passed is parsed using `new URL(...)` at some point.

**Describe the solution you'd like**

It would be great to enable relative paths in browsers so that one doesn't have to determine the origin manually in code when the browser already knows which origin it's operating against. This is particularly annoying when running across different environments, local dev/staging/prod, where the origin differs but the code shouldn't really care.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.