f5devcentral / f5-corkscrew

TMOS parser and application extractor
Apache License 2.0
14 stars 3 forks source link

TypeError: Cannot read properties of undefined (reading 'internal') #23

Closed yamashin55 closed 2 years ago

yamashin55 commented 2 years ago

When I run "corkscrew", it fails with the following error: I couldn't find a fix. Do you have any idea?

root@ubuntu:/home/ubuntu/f5-corkscrew# corkscrew explode bigip_v16.1.2.1.ucs --no_command_logs > demo.json

/usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:297 const dataGroups = Object.keys(configObject.ltm['data-group'].internal);

TypeError: Cannot read properties of undefined (reading 'internal') at /usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:297:79 at Generator.next () at /usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at __awaiter (/usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at /usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:262:43 at Array.forEach () at /usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:262:25 at Generator.next () at /usr/local/lib/node_modules/f5-corkscrew/dist/digConfigs.js:16:71

Node.js v17.4.0

root@ubuntu:/home/ubuntu/f5-corkscrew# node --version && npm --version v17.4.0 8.3.1 root@ubuntu:/home/ubuntu/f5-corkscrew# corkscrew --version 0.9.2

DumpySquare commented 2 years ago

Hi @yamashin55, the cli was for a corner case and I wasn't sure if it was being used or not so I haven't touched it in a while. Can you try to explore that ucs in the vscode-f5 extension?

yamashin55 commented 2 years ago

Below is the log executed from VS Code with "vscode -f5 extension". It seems to be successful halfway, but the same error "Type Error: Cannot read property'internal' of undefined" is output.

1030 [2022-02-02T05:04:34.001Z] [INFO]: f5.cfgExplore, extracting apps 1031 [2022-02-02T05:04:34.078Z] [INFO]: f5.cfgExplore, extraction complete 1032 [2022-02-02T05:04:34.078Z] [INFO]: { objectCount: 2145, sourceSize: 5617264, objects: { virtuals: 152, profiles: 6, pools: 78, irules: 5, monitors: 1, nodes: 138 }, sourceTmosVersion: '16.1.2.1', parseTime: 636.5138, appTime: 72.1651, packTime: 4.4463 } 1033 [2022-02-02T05:04:34.085Z] [ERROR]: --- unhandledRejection --- [TypeError: Cannot read property 'internal' of undefined at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:297:79 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:262:43 at Array.forEach () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:262:25 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at digRuleConfigs (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:250:12) at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:114:19 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at __awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at digVsConfig (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:71:12) at BigipConfig. (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/ltm.js:463:56) at Generator.next () at fulfilled (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/ltm.js:21:58) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)] 1034 [2022-02-02T05:04:34.085Z] [ERROR]: --- unhandledRejection --- [TypeError: Cannot read property 'internal' of undefined at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:297:79 at Generator.next ()

DumpySquare commented 2 years ago

Thanks. That helps. It seems it did not pick up any data-groups. I implemented a fix, but this may be a bigger problem with newer v16.1 code. Please try with the latest 0.9.3 release and let me know the outcome.

yamashin55 commented 2 years ago

A similar error was output.

~/work$ corkscrew --version 0.9.3

-- 29 [2022-02-02T16:42:41.464Z] [INFO]: f5.cfgExplore path revieved: /home/ubuntu/work/f5-corkscrew/16.1.2.1_lb1_Dynad_Key_01.ucs 30 [2022-02-02T16:42:41.464Z] [INFO]: f5.cfgExplore: exploding config @ /home/ubuntu/work/f5-corkscrew/16.1.2.1_lb1_Dynad_Key_01.ucs 31 [2022-02-02T16:42:41.465Z] [INFO]: f5.cfgExplore, opening archive 32 [2022-02-02T16:42:41.505Z] [INFO]: f5.cfgExplore, parsing file -> config/bigip_base.conf 33 [2022-02-02T16:42:41.600Z] [INFO]: f5.cfgExplore, parsing file -> config/bigip.conf 34 [2022-02-02T16:42:41.755Z] [INFO]: f5.cfgExplore, parsing file -> config/bigip_user.conf 35 [2022-02-02T16:42:42.049Z] [INFO]: f5.cfgExplore, parsing file -> config/bigip.license ..

snip

.. . 1038 [2022-02-02T16:42:42.103Z] [INFO]: f5.cfgExplore, extracting apps 1039 [2022-02-02T16:42:42.198Z] [INFO]: f5.cfgExplore, extraction complete 1040 [2022-02-02T16:42:42.198Z] [INFO]: { objectCount: 2145, sourceSize: 5617264, objects: { virtuals: 152, profiles: 6, pools: 78, irules: 5, monitors: 1, nodes: 138 }, sourceTmosVersion: '16.1.2.1', parseTime: 637.2313, appTime: 92.231, packTime: 1.9678 } 1041 [2022-02-02T16:42:42.199Z] [ERROR]: --- unhandledRejection --- [TypeError: Cannot read property 'internal' of undefined at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:297:79 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:262:43 at Array.forEach () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:262:25 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at digRuleConfigs (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:250:12) at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:114:19 at Generator.next () at /home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:16:71 at new Promise () at __awaiter (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:12:12) at digVsConfig (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/digConfigs.js:71:12) at BigipConfig. (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/ltm.js:463:56) at Generator.next () at fulfilled (/home/ubuntu/.vscode-server/extensions/f5devcentral.vscode-f5-3.5.0/node_modules/f5-corkscrew/dist/ltm.js:21:58) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)] 1042 [2022-02-02T16:42:42.199Z] [ERROR]: --- unhandledRejection --- [TypeError: Cannot read property 'internal' of undefined

--

Supplement : VSCode's "CONFIG EXPLOTER" looks like it's confirmed as expected.

yamashin55 commented 2 years ago

The v15.1.4 UCS file did not cause any errors.

DumpySquare commented 2 years ago

Thanks for the feedback. I'll dig into testing this package with v16.1+.

DumpySquare commented 2 years ago

This should be fixed with the latest release. Please confirm

yamashin55 commented 2 years ago

I have uploaded a new version of the "F5 Extension". vscode-f5/3.8.2 As a result, parsing fails for all UCS Version files.


3 [2022-07-25T01:22:10.759Z] [INFO]: ------ Environment Variables ------ 4 [2022-07-25T01:22:10.759Z] [INFO]: F5_CONX_CORE_CACHE=c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\cache 5 [2022-07-25T01:22:10.759Z] [INFO]: F5_CONX_CORE_EXT_HTTP_AGENT=vscode-f5/3.8.2 6 [2022-07-25T01:22:10.759Z] [INFO]: F5_CONX_CORE_REJECT_UNAUTORIZED=false 7 [2022-07-25T01:22:10.759Z] [INFO]: F5_VSCODE_LOG_LEVEL=INFO 8 [2022-07-25T01:22:10.759Z] [INFO]: F5_VSCODE_TEEM=true 9 [2022-07-25T01:22:15.519Z] [INFO]: ------ Environment Variables ------ 10 [2022-07-25T01:22:15.520Z] [INFO]: F5_CONX_CORE_CACHE=c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\cache 11 [2022-07-25T01:22:15.520Z] [INFO]: F5_CONX_CORE_EXT_HTTP_AGENT=vscode-f5/3.8.2 12 [2022-07-25T01:22:15.520Z] [INFO]: F5_CONX_CORE_REJECT_UNAUTORIZED=false 13 [2022-07-25T01:22:15.520Z] [INFO]: F5_TELEMETRY_DEBUG=yes 14 [2022-07-25T01:22:15.520Z] [INFO]: F5_VSCODE_LOG_LEVEL=INFO 15 [2022-07-25T01:22:15.520Z] [INFO]: F5_VSCODE_TEEM=true


60 [2022-07-25T01:23:55.219Z] [ERROR]: --- unhandledRejection --- [TypeError: Cannot read properties of undefined (reading 'loadRules') at CfgProvider. (c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\out\treeViewsProviders\cfgTreeProvider.js:88:45) at Generator.next () at c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\out\treeViewsProviders\cfgTreeProvider.js:15:71 at new Promise () at __awaiter (c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\out\treeViewsProviders\cfgTreeProvider.js:11:12) at CfgProvider.refresh (c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\out\treeViewsProviders\cfgTreeProvider.js:87:16) at c:\Users\tech.vscode\extensions\f5devcentral.vscode-f5-3.8.2\out\treeViewsProviders\cfgTreeProvider.js:75:26 at processTicksAndRejections (node:internal/process/task_queues:96:5)]

If I revert to the old version, the parsing is successful. Old version : v3.7.1

DumpySquare commented 2 years ago

@yamashin55, this may be more related to the last features added in the vscode-f5 extension. I've released another tweek but i'm not seeing this issue in my lab with a handful of ucs/conf/qkviews. If you are still having problems, we may need to get together so you can show me what is happening. Is the cli working as expected?

yamashin55 commented 2 years ago

@DumpySquare, I've upgraded the version of "vscode-f5 extension" to v3.8.3. I've tested with multiple versions. v12.1, v15.1, v16.1. As a result, all the errors have been resolved! Very great! I was impressed. Thank you for your help!

DumpySquare commented 2 years ago

Awesome! thanks!