mickeypearce/oradew-vscode

Cannot read property 'toLowerCase' of undefined

gitguddy opened this issue · 8 comments

When I try to run "Oradew: Import all Sources from DB" im getting "Cannot read property 'toLowerCase' of undefined". All DB-Objects are created as correctly named empty files though.

Can you please post whole text of the error output, including your project path if that is posible.

I suspect there is a space in your project file path or someting similar, that causes the error in getDBObjectFromPath function.

Thanks for your help.

The Error:

> Executing task: node /home/oracle/.vscode/extensions/mp.oradew-vscode-0.3.11/node_modules/gulp/bin/gulp.js --cwd /home/oracle/Dokumente/Oradew_Test --gulpfile /home/oracle/.vscode/extensions/mp.oradew-vscode-0.3.11/out/gulpfile.js --color true --silent true create --env DEV <

Created file ./src/HR/PACKAGES/HR_TEST_PKG.sql
Created file ./src/HR/PROCEDURES/SECURE_DML.sql
Created file ./src/HR/PROCEDURES/ADD_JOB_HISTORY.sql
Created file ./src/HR/PACKAGE_BODIES/HR_TEST_PKG.sql
Created file ./src/HR/VIEWS/EMP_DETAILS_VIEW.sql
Created file ./src/HR/TRIGGERS/SECURE_EMPLOYEES.sql
Created file ./src/HR/TRIGGERS/UPDATE_JOB_HISTORY.sql
Created file ./src/HR/TRIGGERS/EMPLOYEES_EMPLOYEE_ID_TRG.sql
Created file ./src/HR/TABLES/REGIONS.sql
Created file ./src/HR/TABLES/COUNTRIES.sql
Created file ./src/HR/TABLES/LOCATIONS.sql
Created file ./src/HR/TABLES/DEPARTMENTS.sql
Created file ./src/HR/TABLES/JOBS.sql
Created file ./src/HR/TABLES/EMPLOYEES.sql
Created file ./src/HR/TABLES/JOB_HISTORY.sql
Cannot read property 'toLowerCase' of undefined
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

The Project path of an generated file:
/home/oracle/Dokumente/Oradew_Test/src/HR/VIEWS/EMP_DETAILS_VIEW.sql

Nothing unusual ...

One more thing, can you please open an empty file that was created (i.e.: ./src/HR/PACKAGES/HR_TEST_PKG.sql) and execute "Import Current File" (there is a link in the right-click menu or from Command Pallete)

I tried and got this error:

> Executing task: node /home/oracle/.vscode/extensions/mp.oradew-vscode-0.3.11/node_modules/gulp/bin/gulp.js --cwd /home/oracle/Dokumente/Oradew_Test --gulpfile /home/oracle/.vscode/extensions/mp.oradew-vscode-0.3.11/out/gulpfile.js --color true --silent true import --env DEV --file /home/oracle/Dokumente/Oradew_Test/src/HR/TABLES/DEPARTMENTS.sql <

ORA-31600: invalid input value FILE for parameter OBJECT_TYPE in function GET_DDL
ORA-06512: at "SYS.DBMS_METADATA", line 6478
ORA-06512: at "SYS.DBMS_METADATA", line 6264
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA_INT", line 4152
ORA-06512: at "SYS.DBMS_METADATA_INT", line 4629
ORA-06512: at "SYS.DBMS_METADATA_INT", line 9617
ORA-06512: at "SYS.DBMS_METADATA", line 6207
ORA-06512: at "SYS.DBMS_METADATA", line 6320
ORA-06512: at "SYS.DBMS_METADATA", line 9202
ORA-06512: at line 1

Terminal will be reused by tasks, press any key to close it.

I have difficulties in reproducing this, because I am on different platform (Win). But it seems as it fails when parsing the file path (to extract "dir", "owner", "objectName" and "objectType", etc.)

const base = resolve("./");
const relPath = relative(base, absPath);
const pathSplit = relPath.split(sep);
let owner, objectName, dir, objectType, objectType1;
// Object name is always from file name
objectName = parse(absPath).name;
let isScript, isSource;
// Glob matching is too costy...
isScript = pathSplit[0].toLowerCase() === "scripts";
isSource = pathSplit[0].toLowerCase() === "src";

Can you tell me the version of Node you are using. Thanks again (really helpful 👍 )

Node version is:
v10.16.3

and OS? :)

@gitguddy , I rewrote the critical function in the latest version (0.3.12). Can you please confirm if it works now? Thanks again for you help!