-
-
Notifications
You must be signed in to change notification settings - Fork 818
POWERSYNC prototype: add migration to create postgresql publication #1747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is needed since the move to vite on the react side
This wasn't working well with when used over the API
This still needs to be clean up (specially the key generation, at the moment we use a new dependency, but all this can be also done with the library we currently use)
| try: | ||
| return JsonResponse({'token': token, 'powersync_url': settings.POWERSYNC_URL}, status=200) | ||
| except Exception as e: | ||
| return JsonResponse({'error': str(e)}, status=500) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To resolve this, alter the API error response to send a generic message to the consumer instead of the detailed exception message. Internally, log the full exception for debugging and traceability. Specifically, in get_powersync_token in wger/core/api/views.py, replace:
return JsonResponse({'error': str(e)}, status=500)with:
logging.exception("Error creating PowerSync token")
return JsonResponse({'error': 'An internal error has occurred.'}, status=500)This change ensures that the exception detail is captured in server logs for developers and support staff, while API clients cannot see implementation details. Add the use of logging for exceptions in this block only; logging is already imported in the module (line 20).
-
Copy modified lines R476-R477
| @@ -473,7 +473,8 @@ | ||
| try: | ||
| return JsonResponse({'token': token, 'powersync_url': settings.POWERSYNC_URL}, status=200) | ||
| except Exception as e: | ||
| return JsonResponse({'error': str(e)}, status=500) | ||
| logging.exception("Error creating PowerSync token") | ||
| return JsonResponse({'error': 'An internal error has occurred.'}, status=500) | ||
|
|
||
|
|
||
| @api_view() |
most convenient and should be just fine
This is only needed because powersync can't handle joins
This reverts commit c6163de.
- move create publication to core - use ivm entries for the nutrition publications
# Conflicts: # wger/core/static/react/main.js
This is needed in the flutter app to properly be able to set IDs on device, since the regular IDs can only be set by postgres.
# Conflicts: # extras/docker/development/Dockerfile # extras/docker/production/settings.py # requirements.txt # wger/core/api/views.py # wger/nutrition/models/plan.py # wger/urls.py
|
Hey there. What is the current state of this, which steps are needed going forward and how can I help (as a python dev)? |
No description provided.