pylti1.3-flask-example
pylti1.3-flask-example copied to clipboard
pylti1p3.exception.LtiException: Invalid Nonce
Hello,
We are seeing the error pylti1p3.exception.LtiException: Invalid Nonce
happen a lot. The user can typical go back, refresh the page, and it works. Though if they refresh again, it takes another refresh to have the page load.
We are using Canvas if that helps?
readinglistlti-test-reading-1 | [2023-10-20 13:39:30,427] ERROR in app: Exception on /launch/ [POST]
readinglistlti-test-reading-1 | Traceback (most recent call last):
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
readinglistlti-test-reading-1 | response = self.full_dispatch_request()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
readinglistlti-test-reading-1 | rv = self.handle_user_exception(e)
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
readinglistlti-test-reading-1 | rv = self.dispatch_request()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
readinglistlti-test-reading-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/code/reading/app.py", line 112, in launch
readinglistlti-test-reading-1 | message_launch_data = message_launch.get_launch_data()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/pylti1p3/message_launch.py", line 529, in get_launch_data
readinglistlti-test-reading-1 | return self._get_jwt_body()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/pylti1p3/message_launch.py", line 330, in _get_jwt_body
readinglistlti-test-reading-1 | self.validate()
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/pylti1p3/message_launch.py", line 317, in validate
readinglistlti-test-reading-1 | .validate_nonce()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/code/reading/app.py", line 63, in validate_nonce
readinglistlti-test-reading-1 | return super().validate_nonce()
readinglistlti-test-reading-1 | ^^^^^^^^^^^^^^^^^^^^^^^^
readinglistlti-test-reading-1 | File "/venv/readinglistlti-MATOk_fk-py3.11/lib/python3.11/site-packages/pylti1p3/message_launch.py", line 670, in validate_nonce
readinglistlti-test-reading-1 | raise LtiException("Invalid Nonce")
readinglistlti-test-reading-1 | pylti1p3.exception.LtiException: Invalid Nonce
Thanks for your help!
I was getting a lot of nonce validation errors until I changed gunicorn from 4 workers to 1 worker. Possibly related to data storage and it being tied to the particular worker, possibly?
Have you found any other solution to this? I am running into this issue now with 4 workers on gunicorn. @jsogg
Instead of workers I used the -threads unicorn option. It allowed the script to serve multiple users without blocking.
On Thu, Jul 11, 2024, 11:24 AM David Purdy @.***> wrote:
Have you found any other solution to this? I am running into this issue now with 4 workers on gunicorn. @jsogg https://github.com/jsogg
— Reply to this email directly, view it on GitHub https://github.com/dmitry-viskov/pylti1.3-flask-example/issues/22#issuecomment-2223237869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDPBUHWFVHOJ67DKBWJ3HDZL2PTDAVCNFSM6AAAAABKXG7CTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGIZTOOBWHE . You are receiving this because you were mentioned.Message ID: @.***>