frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
20.95k stars 7.18k forks source link

Import Not Started #40811

Open Rolinevdm opened 6 months ago

Rolinevdm commented 6 months ago

Information about bug

I cannot import data through the Data Import Tool. I get no errors. Only "Not Started" status. Steps to reproduce error:

Expected result: Reload page and import was successful, or even failed Actual result: Nothing happens. Import status remains "Not Started" Checking the console in dev mode - nothing happens Just get: POST https://admin.website.tld/api/method/frappe.core.doctype.data_import.data_import.form_start_import

I urgently need to import my data. I have done this process many times on different versions (V13 and 14) and this is a fresh install of version 15.18.1. I notice 2 new updates, but I cannot confirm if this issue gets fixed in these updates.

Module

other

Version

ERPNext version: 15.18.1

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

POST https://admin.website.tld/api/method/frappe.core.doctype.data_import.data_import.form_start_import
konradbr commented 6 days ago

Anyone else get this as well? Any update? I can confirm this still happens in current version (see below) and also using the Template file from ERPnext.

erpnext 15.38.0
frappe 15.43.0
hrms 15.30.0
payments 0.0.1
konradbr commented 6 days ago

OK so here's some further tracing — in my case, the error can be traced (courtesy of https://discuss.frappe.io/t/importing-data-does-not-start/89278/6) to the following Exception:

PermissionError: [Errno 13] Permission denied: './erp.praefabrica.com/public/files/the-file-being-imported.csv'

konradbr commented 6 days ago

Progress update & bug trace

Traced issue to (all) files getting assigned root:root ownership (with corresponding permissions) on upload.

Temporary workaround

Manually reset file permissions:

(Change erpnext:erpnext to frappe:frappe or whatever user your instance is / should be running as...)

chown erpnext:erpnext /opt/erpnext/frappe-bench -R

...then click on Start Import.

konradbr commented 4 days ago

Final bug trace & solution

Bug trace

The identified issue was that newly uploaded files were assigned root:root ownership. This did not preclude files being uploaded and accessed e.g. in Tasks or other DocTypes from the user interface, but caused trouble whenever a background job had to interact with them, as is the case when uploading bank statements.

The underlying issue causing the above was that the instance was running as root on the server, due to a misconfiguration of /opt/erpnext/frappe-bench/config/supervisor.conf (user=root instead of user=erpnext) (we use erpnext as instance user, common is also frappe). The source of the misconfiguration has not been identified, but might have been caused by an overriding update earlier that day.

Implemented solution

The problem was solved by replacing all user=root with user=erpnext in /opt/erpnext/frappe-bench/config/supervisor.conf and running chown erpnext:erpnext /opt/erpnext/frappe-bench -R.