Not null violation: 7 ERROR: null value in column "visitors_referer" of relation "visitors" violates not-null constraint

Created on 20 December 2024, 3 days ago

Problem/Motivation

Similar to a previous ticket 3378953 πŸ› SQLSTATE[23000]: Column visitors_title cannot be null Fixed , but for visitors_referer column.
I noticed the error in my logs (copied below). Note: I modified the hostname in the logs to mynonamehost.com, but it should be noted that the Location is "http" while the referrer is "https".

Date Friday, December 20, 2024 - 08:07
User wescontact
Location
http://mynonamehost.com/visitors/_track?_cvar=%7B%227%22%3A%5B%22route%22%2C%22visitors.performance%22%5D%2C%228%22%3A%5B%22path%22%2C%22%2Fvisitors%2Fperformance%22%5D%2C%229%22%3A%5B%22server%22%2C%22a87f84d82bc8%22%5D%7D&_id=cf3df29fb730f1dc&_idn=0&_refts=0&action_name=Performance%20%7C%20Company%20Name%20LLC&ag=0&cookie=1&fla=0&h=9&idsite=1&java=0&m=7&pdf=1&pf_dm1=238&pf_dm2=33&pf_net=0&pf_onl=4&pf_srv=1014&pf_tfr=68&pv_id=Vmophp&qt=0&r=927683&realp=0&rec=1&res=1920x1080&s=41&send_image=0&uadata=%7B%22fullVersionList%22%3A%5B%7B%22brand%22%3A%22Google%20Chrome%22%2C%22version%22%3A%22131.0.6778.108%22%7D%2C%7B%22brand%22%3A%22Chromium%22%2C%22version%22%3A%22131.0.6778.108%22%7D%2C%7B%22brand%22%3A%22Not_A%20Brand%22%2C%22version%22%3A%2224.0.0.0%22%7D%5D%2C%22mobile%22%3Afalse%2C%22model%22%3A%22%22%2C%22platform%22%3A%22Linux%22%2C%22platformVersion%22%3A%226.9.3%22%7D&uid=0&url=https%3A%2F%2Fmynonamehost.com%2Fvisitors%2Fperformance&wma=0
Referrer https://mynonamehost.com/visitors/performance
Message
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "visitors_referer" of relation "visitors" violates not-null constraint DETAIL: Failing row contains (17, cf3df29fb730f1dc, 0, 172.18.0.1, a87f84d82bc8, 1734703661, 32861, https://mynonamehost.com/visitors/performance, null, /visitors/performance, Performance | Company Name LLC, Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like ..., visitors.performance, 1920x1080, 1, 0, 0, 0, 0, 0, 0, 1, Blink, CH, 131.0, browser, , , desktop, LIN, , 0, en, NA, US, 0, 1014, 68, 238, 33, 4, 1357).: INSERT INTO "visitors" ("visitors_ip", "visitors_uid", "visitors_title", "visitors_user_agent", "config_browser_engine", "config_browser_name", "config_browser_version", "config_client_type", "config_device_brand", "config_device_model", "config_device_type", "config_os", "config_os_version", "bot", "visitor_id", "visitors_url", "visitors_referer", "visitors_path", "route", "server", "config_resolution", "config_pdf", "config_flash", "config_java", "config_quicktime", "config_realplayer", "config_windowsmedia", "config_silverlight", "config_cookie", "pf_network", "pf_server", "pf_transfer", "pf_dom_processing", "pf_dom_complete", "pf_on_load", "pf_total", "visitor_localtime", "visitors_date_time", "language", "location_country", "location_continent") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21, :db_insert_placeholder_22, :db_insert_placeholder_23, :db_insert_placeholder_24, :db_insert_placeholder_25, :db_insert_placeholder_26, :db_insert_placeholder_27, :db_insert_placeholder_28, :db_insert_placeholder_29, :db_insert_placeholder_30, :db_insert_placeholder_31, :db_insert_placeholder_32, :db_insert_placeholder_33, :db_insert_placeholder_34, :db_insert_placeholder_35, :db_insert_placeholder_36, :db_insert_placeholder_37, :db_insert_placeholder_38, :db_insert_placeholder_39, :db_insert_placeholder_40) RETURNING visitors_id; Array ( ) in Drupal\Core\Database\ExceptionHandler->handleExecutionException() (line 64 of /opt/drupal/web/core/lib/Drupal/Core/Database/ExceptionHandler.php).
Severity Error
Hostname 172.18.0.1

Backtrace

#0 /opt/drupal/web/core/modules/pgsql/src/Driver/Database/pgsql/Insert.php(96): Drupal\Core\Database\ExceptionHandler->handleExecutionException()
#1 /opt/drupal/web/modules/contrib/visitors/src/Service/TrackerService.php(60): Drupal\pgsql\Driver\Database\pgsql\Insert->execute()
#2 /opt/drupal/web/modules/contrib/visitors/src/Controller/Visitors.php(198): Drupal\visitors\Service\TrackerService->writeLog()
#3 [internal function]: Drupal\visitors\Controller\Visitors->track()
#4 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#5 /opt/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#6 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#7 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()

Steps to reproduce

The error shows up in the log. Drupal 11 docker installation with Postgres database and an Nginx reverse proxy that is used to terminate the ssl connection.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024