Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2012
    Posts
    364
    Plugin Contributions
    0

    Default Account Creation Error Debug Help

    A customer encountered an error creating an account and I would appreciate some assistance in finding the cause. The error is undefined array keys 'customer_country_id' and 'customer_zone_id' in includes/functions/functions_taxes. Apparently those $_SESSION variables were not set during account creation. Logs showed that the page "account_creation_success" was never requested. Instead a request for includes/templates/template_default/images/icons/error.gif was received by the server, assumed to be for a message to the customer through $messageStack. The customer does not recall what the message was or what she did next.

    My question is related to the timing of events in the client (customers browser) and in the server. Am I correct to assume when the create account "Submit the information" button was clicked in the client browser, a request was sent to the server with data for the server to process. The server log shows the time the request was received by the server and the number of bytes sent back to the client. In this case the response must have included information that the error.gif was to be displayed. The client, not having the required file, then sent a request back to the server for the error.gif file. That request was received by the server at the time in the log entry mentioned above and the file sent back to the client, when the client displayed the error message to the customer.

    Now, when did the server send the response back to the client after the "Submit the information" button data was received? After all account creation processing, including sending emails, was complete, or earlier -- after detecting some error in the received data? In other words, did the server continue to process account creation after notifying the client that it must display the error message? Knowing the answer will help identify whether the error is occurring during the email process or before. There is evidence to suggest that at least some of the account creation emails were sent before the request for the error.gif file request was received by the server. There is no indication that emails bounced.

    For what it's worth, I can not reproduce the problem. Whatever the customer did remains a mystery to me, and the errors continued for every page the customer brought up. The address_book, customer, and order tables all appear correct and complete, as are the emails. The order was successfully completed, but only after the customer must have corrected whatever was wrong, as initially, a Square payment failed due to an invalid country. The product ordered did not require shipping. The product was added to the cart before the account was created. The product involved attributes and no downloads are involved.

    a sample of the error logs and relevant parts of the server logs are attached.

    Dave

    zc157c, php 8.0.2, mysql 8.0.28, SBA, USPS Address Validation, Remember Me, discount modules, ZXPOS, other custom code
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    11,388
    Plugin Contributions
    80

    Default Re: Account Creation Error Debug Help

    Having taken a peek at those server logs, my best guess is that the AJAX USPS Address Validation isn't setting the global $error flag to let the rest of the create_account page's processing know that something's amiss.

    The missing customer_country_id and customer_zone_id indications in the error logs, IMO, enforce that guess.

  3. #3
    Join Date
    Jun 2012
    Posts
    364
    Plugin Contributions
    0

    Default Re: Account Creation Error Debug Help

    Thank you lat9 for your response. But i'm not sure. It's possible that something was wrong when USPS address validation did it's thing but I don't think it was the country or zone_id because the address validation doesn't do anything if the country is not US, the address data in the USPS ajax log at 10:46:40 (PDT) is correct, although sanitized in the log attached in the original post. And there's one more piece of evidence, see below.

    A timeline of events near the end of the account creation follows (all times in EDT):
    • 13:46:47 -- customers_info_date_account_created in customers_info table
    • 13:46:48 -- email received from store by webhost email server to website developer with correct country and zone_id
    • 13:46:48 -- email to website developer saved in email_archive table with correct country and zone_id
    • 13:46:49 -- Welcome email to customer archived
    • 13:46:50 -- welcome email copy to website developer received from store by webhost email server
    • 13:46:51 -- welcome email copy to website developer saved in email_archive table
    • 13:46:51 -- request received at server for error.gif
    • 13:46:51 -- timestamp of first error log


    Notes:
    (1) Order of events with the same time is uncertain.
    (2) Custom code in create_account.php just before tests on the error flag ($error), attempts to match the name and address in the account being created to a table of members in our organization. The results of that match are sent to the website developer in an email containing data derived from $country, $state, and $zone_id. The data in that email show that the country and zone_id were correct just before the test on $error.
    (3) Custom code records the timestamp when an email is archived in the email_archive table.

    Given the data available, I can't see why $_SESSION['customer_country_id'] and $_SESSION['customer_zone_id'] are not set at the end of account creation. I was hoping that the message displayed to the customer could provide a clue, but I can't recreate it. Maybe the message and unset $_SESSION variables are unrelated issues? Ugh.

    Dave

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    11,388
    Plugin Contributions
    80

    Default Re: Account Creation Error Debug Help

    I'll suggest that you check the site's files for occurrences of $_SESSION['customer_country_id'], using either the admin's Developers' Tool Kit or another means.

    Somewhere in the processing it seems that the variable is being 'unset'.

  5. #5
    Join Date
    Jun 2012
    Posts
    364
    Plugin Contributions
    0

    Default Re: Account Creation Error Debug Help

    Raising this problem again...

    Since September 1, I have encountered 8 occurrences of this problem in 52 account creations. The symptoms are identical in each. In the logs, after the account create "submit this information" button is clicked, the USPS address validation process is kicked off followed by:
    [07/Nov/2022:11:15:33 -0800] "POST /index.php?main_page=create_account HTTP/2.0" 302 0 "https://mydomain.com/index.php?main_page=login" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
    [07/Nov/2022:11:15:38 -0800] "POST /index.php?main_page=create_account HTTP/2.0" 200 10574 "https://mydomain.com/index.php?main_page=login" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
    It appears from extensive debugging that includes/modules/create_account.php code is executed a second time, causing issues including the ones described in earlier posts.

    For comparison, the logs for a successful account creation are:
    [05/Nov/2022:09:24:04 -0700] "POST /index.php?main_page=create_account HTTP/2.0" 302 1146 "https://mydomain.com/index.php?main_page=login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15"
    [05/Nov/2022:09:24:10 -0700] "GET /index.php?main_page=create_account_success HTTP/2.0" 200 6371 "https://mydomain.com/index.php?main_page=login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15"
    I have highlighted in red what may be a key indicator of the problem. In every account creation failure, the log indicates 0 bytes returned to the client for the redirect request, while some non-zero number of bytes are returned when account creation is successful. I don't know much about the http detailed protocol between the client and server but could the logs indicate a server problem outside zencart? Or could the problem be in my customization of zencart? Or is it something the client did, like double click, or click twice. For what it's worth, I can not reproduce the problem, no matter what I try. Any suggestions for finding the root cause of this problem would be greatly appreciated!

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    11,388
    Plugin Contributions
    80

    Default Re: Account Creation Error Debug Help

    ... and the logs are created only on the create_account page (and those are the only logs)?

    Those logs are coming from the featured-products' sidebox during the products' price calculation and indicate to be that somehow $_SESSION['customer_id'] has been set but neither the session's customer_country_id nor customer_zone_id values are set (coming from line 35 of functions_taxes.php, function zen_get_tax_rate).

    There are a couple of notifications:

    - NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD
    - NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD
    - NOTIFY_NICK_CREATE_NEW

    ... that occur after the $_SESSION['customer_id'] is set, but before the 'missing' session variables are. Do any of the site's customizations make use of those notifications?

  7. #7
    Join Date
    Jun 2012
    Posts
    364
    Plugin Contributions
    0

    Default Re: Account Creation Error Debug Help

    Thank you for your interest lat9. I appreciate it.

    The two logs for each account creation failure occur on the create_account page. There are other http access logs before and after the two cited above. Immediately before the redirect log are logs related to the USPS address validation. After the 2nd create account POST are logs related to the missing session variables and what the customer did next.

    I had installed some debug trigger_error statements, and email debug data code, as well as code to lookup country_id and zone_id from the newly created address book when the error was encountered to try and avoid the problem. The data seems to show that the account creation was successful up to the point of the redirect to the create_account_success page, that is, the database all appears to be intact. But I have still not determined where the missing session variables are getting wiped out. Instead, I've been focusing on trying to figure out why the redirect is failing, as I believe that is the root cause of the problem.

    As far as the notifiers are concerned, NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD triggers a "Remember Me" observer that sets a cookie in the customer's browser. No observers are associated with the other two notifiers.

 

 

Similar Threads

  1. Customer account creation error
    By michaelchu in forum Managing Customers and Orders
    Replies: 5
    Last Post: 26 Dec 2011, 03:04 AM
  2. Debug error (create account) - cant find error
    By PudzPud in forum Managing Customers and Orders
    Replies: 11
    Last Post: 18 Nov 2011, 08:31 PM
  3. Error on account creation success apge
    By TouranMan in forum General Questions
    Replies: 2
    Last Post: 4 Jan 2007, 10:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR