erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

Creating-user error during Initial setting up of ERPNext-V13

Open johnlongland opened this issue 3 years ago • 6 comments

Description of the issue

Directly after Installation of new ERPNext server and the initialization (login in and entering of country, language, currency etc info), I see errors in the error log.

Context information (for bug reports)

Tried various installation methods ( manual and script ). Error occurs both for manual installation and script installation methods. Installed on Digital Ocean Droplet : 2CPU 4G-RAM, Ubuntu 20.04 LTS

Output of bench version

(erpnext 13.12.0
frappe 13.12.0
)

Steps to reproduce the issue

  1. Install ERPNext
  2. Continue first first-time login (Administrator) and enter all info ..country, currency, language, company etc
  3. Then ERPNext completes its own setting up based on info supplied
  4. Without entering any transactions or other configuration, goto error_log to find 2 errors.
  5. Log out
  6. Log back in as Administrator
  7. Create another user : no error generated in error_log

Observed result

2 errors on error_log

Expected result

No errors in error_log

Stacktrace / full error message

(---------------------------------------------------------------------------------------------------------------
frappe.core.doctype.user.user.create_contact
Traceback (most recent call last):
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 104, in execute_job
    method(**kwargs)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 997, in create_contact
    contact.insert(ignore_permissions=True, ignore_links=ignore_links, ignore_mandatory=ignore_mandatory)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/model/document.py", line 232, in insert
    self._validate_links()
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/model/document.py", line 828, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg),
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 438, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 417, in msgprint
    _raise_exception()
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 371, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.LinkValidationError: Could not find User Id: <EMAIL>
------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------
frappe.core.doctype.user.user.create_contact
Traceback (most recent call last):
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 104, in execute_job
    method(**kwargs)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 997, in create_contact
    contact.insert(ignore_permissions=True, ignore_links=ignore_links, ignore_mandatory=ignore_mandatory)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/model/document.py", line 232, in insert
    self._validate_links()
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/model/document.py", line 828, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg),
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 438, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 417, in msgprint
    _raise_exception()
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 371, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.LinkValidationError: Could not find User Id: <EMAIL>
-----------------------------------------------------------------------------------------)

Additional information

I have also tried different options in terms of country-settings and different emails, everytime on a fresh V13 server to see if I can see a pattern

OS version / distribution, ERPNext install method, etc. node -v && npm -v && python3 -V && pip3 -V && yarn -v v12.22.6 6.14.15 Python 3.8.10 pip 21.2.4 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8) 1.22.15

Ubuntu 20.04 LTS Server version: 10.4.21-MariaDB-

johnlongland avatar Oct 07 '21 09:10 johnlongland

I am currently facing the same issues, trying the installation using frappe_docker. The error is the exact same as above. Is there any news on this bug?

Steps to reproduce

git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker
cp example.env .env
docker-compose -f compose.yaml -f overrides/compose.noproxy.yaml -f overrides/compose.mariadb.yaml -f overrides/compose.redis.yaml -f overrides/compose.erpnext.yaml config > ../docker-compose.yaml
cd ..

So far I have followed the documentations almost exactly. Here I modify the docker-compose.yaml to use my Proxy:

<...>
  frontend:
    depends_on:
      backend:
        condition: service_started
      websocket:
        condition: service_started
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: $$host
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
    image: frappe/erpnext-nginx:v13
    networks:
      default: null
      traefik: null
    volumes:
    - type: volume
      source: assets
      target: /usr/share/nginx/html/assets
      volume: {}
    - type: volume
      source: sites
      target: /usr/share/nginx/html/sites
      volume: {}
    labels:
      traefik.enable: "true"
      traefik.http.routers.erpnext.rule: Host(`erp.example.net`)
<...>
networks:
  default:
    name: frappe_docker_default
  traefik:
    external: true
<...>

Following commands are executed:

docker-compose up -d
docker-compose exec backend bench new-site erp.example.net --mariadb-root-password <db-pass> --admin-password <adm-pass>
docker-compose exec backend bench --site erp.example.net install-app erpnext

Observed Result

Accessing erp.example.net brings up the installer. (So my proxy is seemingly working correctly.) After entering everything, the installer brings up the an "Internal Server Error" Screenshot 2022-03-18 at 20 47 35 The log contains two errors. The installer does not finish setting up. I cannot use the project.

Expected Result

The installer finishes correctly, no errors in Log.

Stacktrace

erpnext-queue-default-1  | 19:30:34 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name='frappe.core.doctype.user.user.create_contact', kwargs={'user': <User: <mail>>, 'ignore_mandatory': True}, method='frappe.core.doctype.user.user.create_contact', site='erp.example.net', user='Administrator') (8995a3e1-bf92-4c81-a7c0-bc21eb1c3f91)
erpnext-queue-default-1  | 19:30:35 Traceback (most recent call last):
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/worker.py", line 1013, in perform_job
erpnext-queue-default-1  |     rv = job.perform()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/job.py", line 709, in perform
erpnext-queue-default-1  |     self._result = self._execute()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/job.py", line 732, in _execute
erpnext-queue-default-1  |     result = self.func(*self.args, **self.kwargs)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 115, in execute_job
erpnext-queue-default-1  |     method(**kwargs)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 997, in create_contact
erpnext-queue-default-1  |     contact.insert(ignore_permissions=True, ignore_links=ignore_links, ignore_mandatory=ignore_mandatory)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 234, in insert
erpnext-queue-default-1  |     self._validate_links()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 837, in _validate_links
erpnext-queue-default-1  |     frappe.throw(_("Could not find {0}").format(msg),
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 444, in throw
erpnext-queue-default-1  |     msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 423, in msgprint
erpnext-queue-default-1  |     _raise_exception()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 378, in _raise_exception
erpnext-queue-default-1  |     raise raise_exception(msg)
erpnext-queue-default-1  | frappe.exceptions.LinkValidationError: Could not find User Id: <mail>
erpnext-queue-default-1  | 
erpnext-queue-default-1  | 19:30:35 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name='frappe.core.doctype.user.user.update_gravatar', kwargs={'name': '<mail>'}, method='frappe.core.doctype.user.user.update_gravatar', site='erp.example.net', user='Administrator') (b7fae15a-0633-4749-9fd3-46ce0437b2bc)
erpnext-queue-default-1  | 19:30:40 default: Job OK (b7fae15a-0633-4749-9fd3-46ce0437b2bc)
erpnext-queue-default-1  | 19:30:40 Result is kept for 500 seconds
erpnext-queue-default-1  | 19:30:40 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name='frappe.core.doctype.user.user.create_contact', kwargs={'user': <User: <mail>>, 'ignore_mandatory': True}, method='frappe.core.doctype.user.user.create_contact', site='erp.example.net', user='Administrator') (bcd86d3f-5fd3-4178-a66b-88ebe3418ae9)
erpnext-queue-default-1  | 19:30:41 Traceback (most recent call last):
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/worker.py", line 1013, in perform_job
erpnext-queue-default-1  |     rv = job.perform()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/job.py", line 709, in perform
erpnext-queue-default-1  |     self._result = self._execute()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/env/lib/python3.9/site-packages/rq/job.py", line 732, in _execute
erpnext-queue-default-1  |     result = self.func(*self.args, **self.kwargs)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 115, in execute_job
erpnext-queue-default-1  |     method(**kwargs)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 997, in create_contact
erpnext-queue-default-1  |     contact.insert(ignore_permissions=True, ignore_links=ignore_links, ignore_mandatory=ignore_mandatory)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 234, in insert
erpnext-queue-default-1  |     self._validate_links()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 837, in _validate_links
erpnext-queue-default-1  |     frappe.throw(_("Could not find {0}").format(msg),
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 444, in throw
erpnext-queue-default-1  |     msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 423, in msgprint
erpnext-queue-default-1  |     _raise_exception()
erpnext-queue-default-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 378, in _raise_exception
erpnext-queue-default-1  |     raise raise_exception(msg)
erpnext-queue-default-1  | frappe.exceptions.LinkValidationError: Could not find User Id: <mail>
erpnext-queue-default-1  | 
erpnext-queue-default-1  | 19:30:41 default: frappe.utils.background_jobs.execute_job(event=None, is_async=True, job_name='frappe.core.doctype.user.user.update_gravatar', kwargs={'name': '<mail>'}, method='frappe.core.doctype.user.user.update_gravatar', site='erp.jweigand.net', user='Administrator') (01f553f9-b611-4d1c-b8fa-0610bb18c58e)
erpnext-queue-default-1  | 19:30:46 default: Job OK (01f553f9-b611-4d1c-b8fa-0610bb18c58e)
erpnext-queue-default-1  | 19:30:46 Result is kept for 500 seconds

defnotjonas avatar Mar 18 '22 19:03 defnotjonas

I have the same problem. Anybody have a fix for it ?

xelfe avatar Mar 23 '22 12:03 xelfe

sadly i ran into the same issue. Anybody have a fix for it ? maybe @revant ?

thomasrehm avatar Mar 29 '22 12:03 thomasrehm

Same issue on V14 in background job

magic-overflow avatar Aug 02 '22 10:08 magic-overflow

File "apps/frappe/frappe/model/document.py", line 895, in validate_links frappe.throw(("Could not find {0}").format(msg), frappe.LinkValidationError) self = <Contact: unsaved> invalid_links = [('user', '[email protected]', 'User Id: [email protected]')] cancelled_links = [] d = <ContactEmail: unsaved> result = ([], []) msg = 'User Id: [email protected]'

magic-overflow avatar Aug 02 '22 10:08 magic-overflow

@defnotjonas for frappe_docker it was discussed here: https://github.com/frappe/frappe_docker/issues/751

revant avatar Aug 02 '22 12:08 revant