Skip to content

How to catch the authorization error with powersync connector? #742

@KarthikRaju391

Description

@KarthikRaju391

I know that the error is happening because my jwt token has expired, I have a way to trigger a token refresh and reconnection but I am unable to catch the following error via the connect method. This error shows up via the logger that I have setup. Any way I can handle this error?

console.js:654 [PowerSyncDatabase[powersync.db]] Error: HTTP : {"error":{"code":"PSYNC_S2103","status":401,"description":"JWT has expired","name":"AuthorizationError"}}
    at ?anon_0_ (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&mi…y=false&runModule=true&excludeSource=true&sourcePaths=url-server:241632:33)
    at next (native)
    at asyncGeneratorStep (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&mi…nly=false&runModule=true&excludeSource=true&sourcePaths=url-server:6571:19)
    at _next (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&mi…nly=false&runModule=true&excludeSource=true&sourcePaths=url-server:6585:29)
    at tryCallOne (address at InternalBytecode.js:1:1180)
    at anonymous (address at InternalBytecode.js:1:1874)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions