Payment MFE returns 404

(this topic was moved from this conversation)

Hello @regis. I still experience this issue, might even add that mine is a bit weirder.

As shown in the picture above, the /payment url flat out returns a 404 error code. Both LMS and Ecommerce do not show any concerning issues that may relate to the error thrown in the payment page.

LMS Logs:

tutor_local-lms-1 | [pid: 7|app: 0|req: 35/91] []( () {60 vars in 3655 bytes} [Fri Mar 10 09:40:17 2023] GET /oauth2/authorize?client_id=ecommerce-sso&redirect_uri=https%3A%2F%[]( => generated 0 bytes in 42 msecs (HTTP/1.1 302) 7 headers in 475 bytes (1 switches on core 0)
tutor_local-lms-1 | 2023-03-10 09:40:17,383 INFO 19 [tracking] [user None] [ip [](] []( - {"name": "/oauth2/access_token", "context": {"user_id": null, "path": "/oauth2/access_token", "course_id": "", "org_id": "", "enterprise_uuid": ""}, "username": "", "session": "", "ip": "[](", "agent": "python-requests/2.28.1", "host": "[](", "referer": "", "accept_language": "", "event": "{\"GET\": {}, \"POST\": {\"grant_type\": [\"authorization_code\"], \"code\": [\"pLtHP4P2mYYqb5llb7NgkrgV3Ndw45\"], \"client_id\": [\"ecommerce-sso\"], \"client_secret\": [\"NiSQTjfK\"], \"redirect_uri\": [\"\"], \"token_type\": [\"jwt\"]}}", "time": "2023-03-10T09:40:17.383352+00:00", "event_type": "/oauth2/access_token", "event_source": "server", "page": null}
tutor_local-lms-1 | [pid: 19|app: 0|req: 36/92] []( () {42 vars in 589 bytes} [Fri Mar 10 09:40:17 2023] POST /oauth2/access_token => generated 835 bytes in 35 msecs (HTTP/1.1 200) 8 headers in 516 bytes (1 switches on core 0)
tutor_local-lms-1 | 2023-03-10 09:40:17,751 INFO 7 [tracking] [user None] [ip [](] []( - {"name": "/enterprise/api/v1/enterprise-learner/", "context": {"user_id": null, "path": "/enterprise/api/v1/enterprise-learner/", "course_id": "", "org_id": "", "enterprise_uuid": ""}, "username": "", "session": "", "ip": "[](", "agent": "python-requests/2.28.1 edx-rest-api-client/5.5.0 [](", "host": "[](", "referer": "", "accept_language": "", "event": "{\"GET\": {\"username\": [\"Calvin\"]}, \"POST\": {}}", "time": "2023-03-10T09:40:17.751632+00:00", "event_type": "/enterprise/api/v1/enterprise-learner/", "event_source": "server", "page": null}
tutor_local-lms-1 | [pid: 7|app: 0|req: 36/93] []( () {40 vars in 1312 bytes} [Fri Mar 10 09:40:17 2023] GET /enterprise/api/v1/enterprise-learner/?username=Calvin => generated 8453 bytes in 26 msecs (HTTP/1.1 404) 7 headers in 665 bytes (1 switches on core 0)
tutor_local-lms-1 | 2023-03-10 09:47:45,166 INFO 19 [tracking] [user None] [ip [](] []( - {"name": "/enterprise/api/v1/enterprise-learner/", "context": {"user_id": null, "path": "/enterprise/api/v1/enterprise-learner/", "course_id": "", "org_id": "", "enterprise_uuid": ""}, "username": "", "session": "", "ip": "[](", "agent": "TelegramBot (like TwitterBot)", "host": "[](", "referer": "", "accept_language": "en-US,en;q=0.5", "event": "{\"GET\": {\"username\": [\"Calvin\"]}, \"POST\": {}}", "time": "2023-03-10T09:47:45.165813+00:00", "event_type": "/enterprise/api/v1/enterprise-learner/", "event_source": "server", "page": null}
tutor_local-lms-1 | [pid: 19|app: 0|req: 37/94] []( () {42 vars in 826 bytes} [Fri Mar 10 09:47:45 2023] GET /enterprise/api/v1/enterprise-learner/?username=Calvin => generated 8453 bytes in 32 msecs (HTTP/1.1 404) 7 headers in 665 bytes (1 switches on core 0)
tutor_local-lms-1 | 2023-03-10 09:48:28,850 INFO 7 [tracking] [user None] [ip [](] []( - {"name": "/sitemap.txt", "context": {"user_id": null, "path": "/sitemap.txt", "course_id": "", "org_id": "", "enterprise_uuid": ""}, "username": "", "session": "", "ip": "[](", "agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; + Chrome/103.0.5060.134 Safari/537.36", "host": "[](", "referer": "", "accept_language": "", "event": "{\"GET\": {}, \"POST\": {}}", "time": "2023-03-10T09:48:28.850594+00:00", "event_type": "/sitemap.txt", "event_source": "server", "page": null}
tutor_local-lms-1 | [pid: 7|app: 0|req: 37/95] []( () {44 vars in 703 bytes} [Fri Mar 10 09:48:28 2023] GET /sitemap.txt => generated 8385 bytes in 30 msecs (HTTP/1.1 404) 7 headers in 665 bytes (1 switches on core 0)

Ecommerce Logs:

tutor_local-ecommerce-1 | [pid: 11|app: 0|req: 12/54] []( () {60 vars in 1360 bytes} [Fri Mar 10 09:39:58 2023] GET /login/?next=/basket/add/%3Fsku%3DA68A349 => generated 0 bytes in 9 msecs (HTTP/1.1 302) 6 headers in 229 bytes (1 switches on core 0)
tutor_local-ecommerce-1 | [pid: 7|app: 0|req: 14/55] []( () {60 vars in 1382 bytes} [Fri Mar 10 09:39:59 2023] GET /login/edx-oauth2/?next=/basket/add/%3Fsku%3DA68A349 => generated 0 bytes in 13 msecs (HTTP/1.1 302) 9 headers in 714 bytes (1 switches on core 0)
tutor_local-ecommerce-1 | [pid: 11|app: 0|req: 13/56] []( () {60 vars in 3435 bytes} [Fri Mar 10 09:40:17 2023] GET /complete/edx-oauth2/?redirect_state=hs6fYkARO8QSCK9LZmf9uo8BgrVClFtf&code=pLtHP4P2mYYqb5llb7NgkrgV3Ndw45&state=hs6fYkARO8QSCK9LZmf9uo8BgrVClFtf => generated 0 bytes in 73 msecs (HTTP/1.1 302) 10 headers in 646 bytes (1 switches on core 0)
tutor_local-ecommerce-1 | 2023-03-10 09:40:17,681 INFO 7 [ecommerce.extensions.basket.views] /openedx/ecommerce/./ecommerce/extensions/basket/[]( - Starting payment flow for user [Calvin] for products [['A68A349']].
tutor_local-ecommerce-1 | 2023-03-10 09:40:17,771 INFO 7 [ecommerce.enterprise.api] /openedx/ecommerce/./ecommerce/enterprise/[]( - Unable to retrieve enterprise learner data for User: Calvin, Exception: 404 Client Error: Not Found for url:
tutor_local-ecommerce-1 | [pid: 7|app: 0|req: 15/57] []( () {60 vars in 3279 bytes} [Fri Mar 10 09:40:17 2023] GET /basket/add/?sku=A68A349 => generated 0 bytes in 121 msecs (HTTP/1.1 303) 7 headers in 246 bytes (1 switches on core 0)

Only caddy and mfe show, in the logs that there is an error somewhere.

Caddy and mfe logs:
tutor_local-mfe-1 | {"level":"error","ts":1678441481.0026057,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_addr":"[](","proto":"HTTP/1.1","method":"GET","host":"[](","uri":"/payment"},"user_id":"","duration":0.00012625,"size":0,"status":404}
tutor_local-caddy-1 | {"level":"error","ts":1678441481.0028024,"logger":"http.log.access.log4","msg":"handled request","request":{"remote_ip":"[](","remote_port":"3411","proto":"HTTP/2.0","method":"GET","host":"[](","uri":"/payment","tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"[]("}},"user_id":"","duration":0.00133419,"size":0,"status":404}

We had to downgrade to Nutmeg to get the payment page working. We still have no luck of getting the payment page back up, let alone find out the cause of the issue. Would appreciate any help here.

I moved your answer to a new topic, as the issue you are describing is different from the original one.

The payment MFE will only be available if you re-build the MFE image. Did you run tutor images build mfe?

Sorry for the late reply @regis . We did a couple of times, and we haven’t faced any issues while building MFE.

What version of Tutor and the ecommerce/mfe plugins are you running?

tutor --version
tutor plugins list


Thanks @Master_kratos for the ping. Hello @regis

Tutor Version: v15.3.1 ( latest )
Tutor-ecommerce: v15.0.2
Tutor-mfe: v15.0.5

There is something I just caught on by looking at your screenshot that cannot find and the logs that only show links to

Could there be an SSL configuration issue between your LMS and the different apps ?
I also see links to

Just curious.

Good eyes @sambapete. Wish I could say for certain if it is or isn’t an SSL configuration issue. We had issues with Cloudflare over SSL configurations sometime ago, but we changed our DNS Providers. We usually let Tutor handle everything and we try to avoid tinkering with anything inside Tutor’s domain.

Hello @sambapete @regis. The SSL misconfiguration was an interesting theory, hence wanted to give it a go again without any SSL configuration. This time, the payment page hasn’t returned a 404 response.

What would be the best SSL configuration, do you think?

For context, we used Caddy’s SSL certificates generated during tutor local launch.

Your question inspired me to write this issue: Many users have trouble figuring out which ingress hosts need to be proxied · Issue #7 · openedx/wg-devops · GitHub

That’s a nice read @regis. It could be really helpful to a lot of users.

Question @regis.

When Tutor prompts a user if they’d like to enable HTTPS during tutor local launch, does it set up SSL for specific domain / sub-domain (s) only or does it set up for all sub-domains involved in production?

This is a common source of confusion. Tutor does not really setup SSL for any service. When you answer “yes” to that SSL question during tutor local launch, all Tutor does is to configure all service urls to run on https. For instance, the Django settings for the LMS are setup to accept secure cookies, ecommerce and other IDAs are reached via https://…, etc.

Then, when ENABLE_HTTPS=true and ENABLE_WEB_PROXY=true, Caddy is configured to fetch certificates from Let’s Encrypt.

If ENABLE_HTTPS=true and ENABLE_WEB_PROXY=false, then Caddy assumes that SSL certificates are generated elsewhere – but we still use https urls for all services.

When ENABLE_HTTPS=false then we assume that all communications happen via http between the different services.

I highly recommend you carefully read this tutorial again: Running Open edX behind a web proxy — Tutor documentation
In particular, I suspect that you may not have properly set the X-Forwarded-* headers in your proxy.

Thank you @regis.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.