sivertschou / dundring

dundring.com is a free and open source in-browser training application created to control and track your training with a smart bike trainer⚡️
https://dundring.com
Apache License 2.0
62 stars 8 forks source link

Fix strava auth - update refresh token bug #394

Closed morteako closed 2 months ago

morteako commented 2 months ago

The code tries to update the user before it is created. leading to an error. This error is ignored, and only logged, so it works. but better to skip it and only do it when needed

@dundring/backend:dev: [db.updateStravaRefreshToken]: PrismaClientKnownRequestError:
@dundring/backend:dev: Invalid `prisma.stravaAuthentication.update()` invocation in
@dundring/backend:dev: /Users/mortenkolstad/dundring/apps/backend/src/db.ts:443:54
@dundring/backend:dev:
@dundring/backend:dev:   440   Status<StravaAuthentication, 'Something went wrong while writing to database'>
@dundring/backend:dev:   441 > => {
@dundring/backend:dev:   442   try {
@dundring/backend:dev: → 443     const result = await prisma.stravaAuthentication.update(
@dundring/backend:dev: An operation failed because it depends on one or more records that were required but not found. Record to update not found.
morteako commented 2 months ago

Can/will probably be extended and part of the strava-upload PR . can close this one. no need for churn