Skip to content
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

Invalid field name #35

Closed
arikgelman opened this issue Oct 26, 2017 · 32 comments
Closed

Invalid field name #35

arikgelman opened this issue Oct 26, 2017 · 32 comments

Comments

@arikgelman
Copy link

Hi,

First I want to say thank you for this amazing package!

I am getting this error when trying to subscribe using chrome:

django.core.exceptions.FieldError: Invalid field name(s) for model SubscriptionInfo: 'expirationTime'.

I tried to remove the field 'expirationTime' from the dictionary under views:

`# We at least need the user or group to subscribe for a notification
if request.user.is_authenticated() or group_name:
# Save the subscription info with subscription data
# as the subscription data is a dictionary and its valid
print(subscription_data)
subscription_data.pop('expirationTime')
subscription = subscription_form.get_or_save(subscription_data)
web_push_form.save_or_delete(
subscription=subscription, user=request.user,
status_type=status_type, group_name=group_name)

        # If subscribe is made, means object is created. So return 201
        if status_type == 'subscribe':
            return HttpResponse(status=201)
        # Unsubscribe is made, means object is deleted. So return 202
        elif "unsubscribe":
            return HttpResponse(status=202)`

And it worked but sending notifications to the subscribed browser is not working.
By the way Firefox is working great.

Please help,
Thanks!

@safwanrahman
Copy link
Owner

Hi @arikgelman, Sorry for the problem and the delay in replying.
I hope to look on it later today or tomorrow. Let me know if you have any more information regarding it.

@DaveRev
Copy link

DaveRev commented Dec 21, 2017

Hi! I have the same problem, sending notifications to the subscribed browser is not working. Did you solve it?

@arikgelman
Copy link
Author

No, still waiting for a fix

@safwanrahman
Copy link
Owner

Sorry, I could not manage time to work on this due to University and work pressure.
I am hoping to work on this in the holiday period, but cant promise.
Are you guys interested to find the underling issue?

@safwanrahman
Copy link
Owner

@arikgelman @DaveRev I have just fixed the issue you have mentioned. Some documentation is needed for sending notification to chrome, will do this shortly.

@safwanrahman
Copy link
Owner

@arikgelman Can you check the latest master version if its still raising error?

@arikgelman
Copy link
Author

@safwanrahman , I am pressing the "Subscribe to Push Messaging" in chrome and I am not getting any request from the browser to approve, I can see in the database the "PushInformation object" and when I am trying to send a test message I am getting this error:
Push failed: <Response [410]>: {"code": 410, "errno": 106, "error": "", "more_info": "http://autopush.readthedocs.io/en/latest/http.html#error-codes", "message": "Request did not validate No such subscription"}

Firefox still working.

@safwanrahman
Copy link
Owner

@arikgelman I have updated the documentation. Can you please check again according to it?
Please be mentioned that GCM_KEYS are no longer in use.

@arikgelman
Copy link
Author

arikgelman commented Mar 4, 2018

@safwanrahman , Sorry, still not working, now its just hangs when I press the "Subscribe to Push Messaging" and nothing is added to database. This is the error from the Chrome console:
Subscription error. DOMException: Registration failed - missing applicationServerKey, and manifest empty or missing
Firefox still working

@safwanrahman
Copy link
Owner

Can you please put the browser console output?

@arikgelman
Copy link
Author

@safwanrahman

Subscription error. DOMException: Registration failed - missing applicationServerKey, and manifest empty or missing

@safwanrahman
Copy link
Owner

Can you please uninstall and reinstall directly from github?

@arikgelman
Copy link
Author

@safwanrahman , Still not working, same error.

@safwanrahman
Copy link
Owner

@arikgelman I have made a new release. Can you please check the latest one?

@arikgelman
Copy link
Author

@safwanrahman I am getting installation error:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Temp\pip-nzyjevri-build\setup.py", line 5, in <module>
    README = readme.read()
  File "c:\python35\lib\encodings\cp1255.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9c in position 4874: character maps to <undefined>

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in

@safwanrahman
Copy link
Owner

@arikgelman What did you run?

@arikgelman
Copy link
Author

@safwanrahman : pip install django-webpush.zip

@safwanrahman
Copy link
Owner

@arikgelman please run pip install -U django-webpush
I do not have a windows machine to test your error! 😢

@arikgelman
Copy link
Author

arikgelman commented Mar 8, 2018

@safwanrahman OK, I found the problem, change in the setup.py file to this:

with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding="utf-8") as readme: README = readme.read()

@arikgelman
Copy link
Author

@safwanrahman , Sorry, still the same error, I also added manifest.json to my site but still the same error.

@safwanrahman
Copy link
Owner

@arikgelman Can you please let me know which version of chrome you are using?

@arikgelman
Copy link
Author

@safwanrahman Version 65.0.3325.146 (Official Build) (64-bit)

@arikgelman
Copy link
Author

It looks like Opera is not working either, Firefox is working on mobile and desktop. Chrome is not working on mobile and desktop.

@arikgelman
Copy link
Author

arikgelman commented Mar 10, 2018

@safwanrahman OK, I was able to fix the registration process in chrome, Now I was able to register with chrome but when I am trying to send a test message I am getting this error:
`
Exception Type: WebPushException at /admin/webpush/pushinformation/
Exception Value: Push failed: <Response [400]>:

<TITLE>UnauthorizedRegistration</TITLE>

UnauthorizedRegistration

Error 400

`

@jamaalscarlett
Copy link
Contributor

Did you forget to include the credentials in the request?

@safwanrahman
Copy link
Owner

@arikgelman Have you setup WEBPUSH_SETTINGS as mentioned in the doc?

image

@arikgelman
Copy link
Author

Yes

@arikgelman
Copy link
Author

@safwanrahman Hi, any idea what could be the problem?

@safwanrahman
Copy link
Owner

@arikgelman I am actually investigating it. I barely use the test message.
Can you please check from the django shell?

@arikgelman
Copy link
Author

@safwanrahman Hi, still the same error:

`
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "", line 1, in
File "/webpush/init.py", line 13, in send_user_notification
send_notification_to_user(user, payload, ttl)
File "/webpush/utils.py", line 11, in send_notification_to_user
_send_notification(push_info, payload, ttl)
File "/webpush/utils.py", line 39, in _send_notification
req = webpush(subscription_info=subscription_data, data=payload, ttl=ttl, **vapid_data)
File "/usr/local/lib/python3.5/dist-packages/pywebpush/init.py", line 384, in webpush
result, result.text))
pywebpush.WebPushException: Push failed: <Response [400]>:

<TITLE>UnauthorizedRegistration</TITLE>

UnauthorizedRegistration

Error 400

`

@safwanrahman
Copy link
Owner

I will investigate this in the weekend!

@akram256
Copy link

Hey @safwanrahman. I have an issue I am facing. I Kindly request for assistance
This is the error below
WebPushException: Push failed: 410 Gone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants