pocketbase/js-sdk

Current production library is broken and developers must get the v0.21.1 tag

opencoca opened this issue · 6 comments

Title: Regression in master branch impacting compatibility with pocketbase/js-sdk v0.22.9

Description:

There appears to be a regression in the current master branch of the pocketbase/js-sdk that affects projects using the latest version (v0.22.9) of PocketBase. As a result, developers need to revert to pocketbase/js-sdk at tag v0.21.1 to maintain functionality.

Steps to Reproduce:

  1. Update to the latest master branch of pocketbase/js-sdk.
  2. Integrate with a project running PocketBase v0.22.9.
  3. Observe the resulting issues.

Expected Behavior:
The pocketbase/js-sdk should seamlessly integrate with projects using any current version of PocketBase, including v0.22.9.

Actual Behavior:
Integrating the latest master branch of pocketbase/js-sdk with PocketBase v0.22.9 leads to compatibility issues, requiring a fallback to an older version (v0.21.1).

Possible Solutions:

  • Review recent commits to the master branch for potential breaking changes or compatibility issues.
  • Implement a more robust testing procedure to catch such regressions before code is merged into production.

Additional Context:
This issue requires prompt attention to maintain the reliability and usability of the SDK with newer versions of PocketBase. Please ensure that future updates undergo thorough testing to prevent similar issues.

I don't understand what do you mean and it is working correctly for me.

The only difference between the tag v0.21.1 and the master is one commit related to the changelog - 09f38c5.

If this is some sort of automated issue submission, please stop doing it.

If you still think that there is an issue, then please clearly elaborate what is not working and ideally provide minimal reproducible steps.

I'm not automated ; ). I too don't know what more to say...

When pulling from your master and setting up the pocket base js-sdk using a script tag:

<script src="[js/pocketbase.umd.js](http://127.0.0.1:8090/js/pocketbase.umd.js)"></script> and following it up with a: const pb = new PocketBase('http://127.0.0.1:8090');

pb.collection(...) doesn't work :( ... downgrade to the tag and it does in my tests. \o/

@opencoca It is still not clear what is not working and what is the error.

I've just downloaded the umd bundle from master - https://raw.githubusercontent.com/pocketbase/js-sdk/master/dist/pocketbase.umd.js and the below code is working correctly for me:

<!DOCTYPE html />
<html>
<head>
    <meta charset="utf-8" />
    <title>Test</title>
</head>
<body>
    <script src="./pocketbase.umd.js"></script>
    <script type="module">
        const pb = new PocketBase("http://127.0.0.1:8090");

        const result = await pb.health.check()

        console.log(result)
    </script>
</body>
</html>

Place the above in pb_public/index.html together with the downloaded file, navigate in your browser to http://127.0.0.1:8090 and check the console.

Again, the only difference between the tag and master is the changelog commit, you can inspect the commits on your own in https://github.com/pocketbase/js-sdk/commits/master/.

If you are still not able to make it work, please create a minimal reproducible repo.

Here is a also a link to an online repl that shows that it is working correctly - https://playcode.io/1843779

Interesting, as that is talking to the demo instance of https://pocketbase.io/ and not the the local instances my tests are downloading from https://github.com/pocketbase/pocketbase/releases/tag/v0.22.9
I didn't test talking to pocketbase.io and only talking to local instances of pocketbase.

If I have time between other things I'll pass you a repo ,but it's late where I am and I have other things to deal with.

The fix for me was to fallback to an older version (v0.21.1) and now I'm too in a situation where it works for me :D

There is no difference between the live demo and PocketBase v0.22.9 release.
Additionally as mentioned earlier it works locally too.

The fix for me was to fallback to an older version ...

With risk to repeat my self again, both the JS SDK v0.21.1 tag and master branch has the same dist folder. Please check the commits https://github.com/pocketbase/js-sdk/commits/master/. v0.21.1 is pointing to the 73ed625 hash. The master is the last one which has only change to the CHANGELOG.md file.

I don't think I can help you further, but if you stumble on something else please provide at least information about the error message or stack trace, otherwise we are just going in circles.