apigee-edge-drupal icon indicating copy to clipboard operation
apigee-edge-drupal copied to clipboard

Apigee X/Hybrid: Developer creation silently fails with uppercase characters in user email address

Open mxr576 opened this issue 2 years ago • 0 comments

Description

The Apigee/Drupal connection only functional properly when every Drupal user has a developer account Apigee. This is the constraint that we try to enforce since day 1 with different solutions, like developer create/update on user create/update or via the Developer sync feature.

With Apigee X/Hbyrid, the user creation is successful even if the developer creation failed with INVALID_ARGUMENT: email address has to be lowercase.

Apigee Info

Apigee X/Hybrid

Steps to Reproduce

a) Create a user with uppercase characters in their email address, like [email protected]. b) Run developer sync on a developer portal that has users with uppercase characters in their email addresses.

Actual Behavior

a) The developer creation silently fails, leads to other unexpected errors in other places because an existing Drupal user has no developer account on Apigee. With Apigee Edge Debug module enabled the following log message can be found:

POST /developers HTTP/1.1
>>>>>>>>
POST /v1/organizations/***organization***/developers HTTP/1.1
Host: apigee.googleapis.com
Content-Length: 149
X-Apigee-Edge-Api-Client-Profiler: X-Apigee-Edge-Api-Client-Profiler
Content-Type: application/json
User-Agent: Apigee Edge/3.0.2; Drupal/10.1.4 (Apigee Edge PHP Client/3.0.1; PHP/8.1.21)
Accept: application/json; charset=utf-8

{"apps":[],"attributes":[],"companies":[],"email":"[email protected]","firstName":"John","lastName":"Doe U","status":"active","userName":"JohnDoe"}

<<<<<<<<
HTTP/1.1 400 Bad Request
Vary: X-Origin, Referer, Origin,Accept-Encoding
Content-Type: application/json; charset=UTF-8
Date: Wed, 27 Sep 2023 08:55:37 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Accept-Ranges: none
Transfer-Encoding: chunked

{
    "error": {
        "code": 400,
        "message": "email address has to be lowercase",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com\/google.rpc.RequestInfo",
                "requestId": "6705244442943647307"
            }
        ]
    }
}

b) Developer sync simply skips the user with a message: Skipping [email protected] developer. INVALID_ARGUMENT: email address has to be lowercase

Expected Behavior

a) Should fail with a field level constraint validation error (was also recommended here) as long as Apigee X/Hybrid does not support email addresses described in RFC 5321 section 2.3.11.

b) Probably works as designed, although it would better if the field level validation would fail and that would be reported instead of the API call and the report would expose the underlying error message from the API backend.

Screenshots

N/A

Notes

  • There was a previous unfinished attempt to mitigate this problem: https://github.com/apigee/apigee-edge-drupal/pull/756
  • Related community post about the underlying problem: https://www.googlecloudcommunity.com/gc/Apigee/Apigee-Edge-to-Apigee-X-migration-INVALID-ARGUMENT-email-address/td-p/641748

Version Info

Apigee Edge 3.0.2

mxr576 avatar Sep 27 '23 10:09 mxr576