tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
226 stars 32 forks source link

Next.js build fails due to this regex #160

Closed lightyaer closed 8 months ago

lightyaer commented 8 months ago

Next.js build fails when you upgrade to 14.0.3+ versions.

Upon searching I found this issue in next.js repo - https://github.com/vercel/next.js/issues/59540 which points that a regex change which fixes the build issue.

In the latest version of libsql-client-ts 0.4.0-pre.10, the fix has been implemented, but,

Fails the build with a Collecting Page Data error.

Using a string concatenation solves this.

Also, tagging another issue from this repo

Fixes #142 Fixes vercel/next.js#59540

penberg commented 8 months ago

@giovannibenussi @notrab please review

giovannibenussi commented 8 months ago

The code in general looks good but has a few issues that are reflected in the tests. For example, we got the error "URL_PARAM_NOT_SUPPORTED: Unknown URL query parameter \"1\"" in the test below, which means that we're doing something wrong in the parsing. I'll leave further comments in the code if I find something that could be causing those issues and take another look once they're fixed!

test("URL scheme incompatible with ?tls", () => {
    const urls = [
        "ws://localhost?tls=1",
        "wss://localhost?tls=0",
        "http://localhost?tls=1",
        "https://localhost?tls=0",
    ];
    for (const url of urls) {
        expect(() => createClient({url}))
            .toThrow(expect.toBeLibsqlError("URL_INVALID", /TLS/));
    }
});
penberg commented 8 months ago

Fixed by https://github.com/tursodatabase/libsql-client-ts/pull/172 so closing this PR.