Closed johnny77221 closed 5 months ago
I have moved the machine into a public web with assigned domain and SSL the error turns into: jwt.exceptions.DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().
is it able to run a test environment in development (local.edly.io) mode? or it just need to be a production server?
Yes, you can run test environment locally with tutor dev
.
jwt.exceptions.DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().
Hi @johnny77221 could you please mention the steps to regenerate this issue?
first, I installed and enabled plugins: tutor plugins enable discovery ecommerce mfe then set cybersource key in config: tutor config save --set "ECOMMERCE_PAYMENT_PROCESSORS=$(cat ecommerce-config.yml)" and rebuild images: tutor images build then I run with tutor local launch and setup a paid course with http://ecommerce.local.edly.io/courses
after above steps, the config needs to change in Home/Core/Site configurations: http://ecommerce.local.edly.io/admin/core/siteconfiguration/
the payment page should be /payment/ the slash in the end is required or it will display a blank page when added to cart
after above steps, user can add a paid course into cart the first mentioned error appears and I got a server and domain to run in production mode (re-run tutor local launch with SSL settings)
and change payment URL again (this seems required every time after tutor local launch) and this JWT error appears
It seems pyJWT version had a breaking change after 1.7.1, here is a similar problem in azure sdk https://github.com/Azure/azure-sdk-for-python/issues/16035#issuecomment-763285406
also I looked up https://github.com/openedx/ecommerce-worker found pyjwt==2.6.0 in pip requirements but I have not found .decode() calling in the repo maybe downgrading pyjwt to 1.7.1 is a choice but not sure if any side effects will happen
I tried to fork both tutor-ecommerce and ecommerce repo to specify algorithm
in line 225 of cybersource.py in Ecommerce repo I changed to (capture_context, jwt.decode(capture_context['key_id'], algorithms=['RS256'], verify=False)) to specify the algorithm, but no luck. when I use HS256 it says jwt.exceptions.InvalidAlgorithmError: The specified alg value is not allowed when I use RS256 it says ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [<OpenSSLError(code=503841036, lib=60, reason=524556, reason_text=unsupported)>])
seems they used some algorithm but I didn't know for decoding
Hi @johnny77221 , Can u please attach some more screenshots about where are you getting the error in payment mfe or its a completely blank page. What is the tutor version you are running. If you are using mounted version of payment mfe, then what is it? Can u please specify the versions?
is it able to run a test environment in development (local.edly.io) mode?
after above steps, the config needs to change in Home/Core/Site configurations: http://ecommerce.local.edly.io/admin/core/siteconfiguration/
the payment page should be /payment/ the slash in the end is required or it will display a blank page when added to cart
I tried running tutor-ecommerce and payment mfe in tutor dev
mode, its working. If you can please specify the issue in detail and the versions, it will be easy to debug the cause.
Hi, I am using following versions (from pip freeze) tutor==17.0.0 tutor-android==17.0.0 tutor-cairn==17.0.0 tutor-credentials==17.0.0 tutor-discovery==17.0.0 utor-forum==17.0.0 tutor-indigo==17.2.0 tutor-jupyter==17.0.0 tutor-mfe==17.0.0 tutor-minio==17.0.0 tutor-notes==17.0.0 tutor-webui==17.0.0 tutor-xqueue==17.0.0
in your screenshot, there is an error message about "unexpected problem", and that's the problem in the browser console, you should see HTTP 400 error if you type tutor local logs e-commerce, it will show up errors what I pasted
It seems need to modify Ecommerce repo this modification works:
Hi @johnny77221, Thanks for the PR. The solution looks good to me. I'll also test it.
first, I installed and enabled plugins: tutor plugins enable discovery ecommerce mfe then set cybersource key in config: tutor config save --set "ECOMMERCE_PAYMENT_PROCESSORS=$(cat ecommerce-config.yml)" and rebuild images: tutor images build then I run with tutor local launch and setup a paid course with http://ecommerce.local.edly.io/courses
after above steps, the config needs to change in Home/Core/Site configurations: http://ecommerce.local.edly.io/admin/core/siteconfiguration/
the payment page should be /payment/ the slash in the end is required or it will display a blank page when added to cart
after above steps, user can add a paid course into cart the first mentioned error appears and I got a server and domain to run in production mode (re-run tutor local launch with SSL settings)
and change payment URL again (this seems required every time after tutor local launch) and this JWT error appears
Hi @johnny77221, Thanks for this awesome explanation! Payment page was indeed appearing as blank. I have created a PR for this issue. It will be merged soon.
It seems need to modify Ecommerce repo this modification works:
openedx/ecommerce@open-release/quince.master...johnny77221:ecommerce:open-release/quince.master
Your above solution worked as well as it resolved decoding issue. Hello @regisb, Can you look at his PR. It is closed without being merged although it resolved the above decoding error.
The upstream PR https://github.com/openedx/ecommerce/pull/4138 has been merged, this should be good to close now.
Hello
I followed this https://overhang.io/tutor/plugin/ecommerce page to setup with cybersource sandbox keys in the payment page, Its showing error HTTP 400 for http://ecommerce.local.edly.io/bff/payment/v0/capture-context/
and tutor local logs Ecommerce shows these message:
would you have idea how to fix this? is it able to run a test environment in development (local.edly.io) mode? or it just need to be a production server?