django-push-notifications icon indicating copy to clipboard operation
django-push-notifications copied to clipboard

Breaking change in 3.0.3

Open daveisfera opened this issue 1 year ago • 13 comments

There's a breaking change in the 3.0.3, so could that be reverted and included in a major release?

daveisfera avatar Aug 22 '24 19:08 daveisfera

@daveisfera can you point to the breaking change?

jamaalscarlett avatar Sep 09 '24 13:09 jamaalscarlett

It's the FCM change that I linked to. The description at the top of the page that I linked to in the original report says this:

- GCM and legacy FCM API support have been removed. (GCM is off since 2019, FCM legacy will be turned off in june 2024)
- Firebase-Admin SDK has been added

daveisfera avatar Sep 09 '24 14:09 daveisfera

Those are the release notes. Do you have specific PR or commit that contains the breaking changes?

jamaalscarlett avatar Oct 14 '24 05:10 jamaalscarlett

I'm not sure which commit caused the problem, but with 3.0.2 and before, my application loads.

With 3.0.3, I get this error:

  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/venv/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/usr/src/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
    autoreload.raise_last_exception()
  File "/usr/src/venv/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/usr/src/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
    autoreload.check_errors(django.setup)()
  File "/usr/src/venv/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/usr/src/venv/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/src/venv/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/usr/src/venv/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/src/app/myapp/models.py", line 34, in <module>
    from myapp.tasks import (
  File "/usr/src/app/myapp/tasks.py", line 13, in <module>
    from myapp.notifications import Notification
  File "/usr/src/app/myapp/notifications.py", line 10, in <module>
    from push_notifications.apns import APNSError
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/apns.py", line 15, in <module>
    from .conf import get_manager  
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/__init__.py", line 22, in <module>
    get_manager()
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/__init__.py", line 16, in get_manager
    manager = import_string(SETTINGS["CONFIG"])()
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/app.py", line 82, in __init__
    self._validate_applications(self._settings["APPLICATIONS"])
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/app.py", line 87, in _validate_applications
    self._validate_config(application_id, application_config)
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/app.py", line 117, in _validate_config
    getattr(self, validate_fn)(application_id, application_config)
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/app.py", line 186, in _validate_fcm_config
    self._validate_allowed_settings(application_id, application_config, allowed)
  File "/usr/src/venv/lib/python3.9/site-packages/push_notifications/conf/app.py", line 227, in _validate_allowed_settings
    raise ImproperlyConfigured(    
django.core.exceptions.ImproperlyConfigured: Platform FCM, app pa_fcm does not support the setting: API_KEY.

daveisfera avatar Oct 14 '24 22:10 daveisfera

hi @daveisfera, is this resolved in newer versions? a newer release would be happening soon and i would like to check in if this had been resolved

50-Course avatar Jan 07 '25 22:01 50-Course

I just tried upgrading to 3.1.0 and it has the same issue

daveisfera avatar Jan 08 '25 02:01 daveisfera

It appears that this commit is what broke things, so could it be reverted and then breaking changes like this made with the release of 4.0?

daveisfera avatar Jan 08 '25 02:01 daveisfera

@daveisfera Are you still seeing this error? Are you using legacy FCM? My understanding was that legacy FCM was deprecated last summer, and going forward auth required a private key as described here: https://firebase.google.com/docs/admin/setup/#python_3

jamaalscarlett avatar Jan 21 '25 01:01 jamaalscarlett

Yes, it still happens with the recent 3.2 release. I am using legacy FCM and I totally understand that it's been deprecated and even ok with the removal, but I'm requesting that be done in a 4.0 release since it's a breaking change. Such a change being done in a minor release ( 3.0.3 to be exact) is really problematic and I have verified that reverting the commit that I referenced in my last comment fixes the issue

daveisfera avatar Jan 21 '25 02:01 daveisfera

@daveisfera OK, looks like we will need to re-add support for legacy FCM

jamaalscarlett avatar Jan 22 '25 03:01 jamaalscarlett

@daveisfera which endpoint are using to send the request? Wen I attempt to send a request using the legacy API I am seeing 401 INVALID_KEY errors. I would like to be able to test the fix before I roll it out

jamaalscarlett avatar Jan 28 '25 03:01 jamaalscarlett

@daveisfera ?

jamaalscarlett avatar Feb 07 '25 13:02 jamaalscarlett

We've decided to remove our use of this module because the dependencies it use that are abandoned and the security concerns and issues with 3.9 coming up on EoL that that entails.

daveisfera avatar Feb 18 '25 04:02 daveisfera