EVerest / EVerest/everest-admin-panel
TypeError: can't convert undefined to object when loading configs with modules that have no provides
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
Version: v0.5.1
## Description
Loading certain config files (e.g. `config-sil`) crashes with:
TypeError: can't convert undefined to object
## Steps to Reproduce
1. Connect the admin panel to a live EVerest instance running config-sil
2. Go to Menu → Config → Available configs
3. Select config-sil
4. Observe the TypeError crash
## Root Cause
`provides` is optional in an EVerest module manifest. Modules like `API`, `EvAPI`, and `Setup` are consumer-only and have no
`provides` section. In `src/modules/evbc/config_model.ts`, `_add_module_instance` calls `Object.entries(manifest.provides)`
without guarding against `undefined`:
```ts
// line 396
Object.entries(manifest.provides).forEach(([impl_name, impl_def]) => {
```
This causes Object.entries(undefined) to throw.
## Patch
```ts
diff --git a/src/modules/evbc/config_model.ts b/src/modules/evbc/config_model.ts
index 1fdff24..10916f8 100644
--- a/src/modules/evbc/config_model.ts
+++ b/src/modules/evbc/config_model.ts
@@ -393,7 +393,7 @@ class EVConfigModel {
const manifest = this._module_definitions[type];
const impl_configs: Record = {};
- Object.entries(manifest.provides).forEach(([impl_name, impl_def]) => {
+ Object.entries(manifest.provides ?? {}).forEach(([impl_name, impl_def]) => {
const impl_config =
config?.config_implementation !== undefined && impl_name in config.config_implementation
? config.config_implementation[impl_name]
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/modules/evbc/config_model.ts at _add_module_instance around line 396 and reproduce the config-sil loading flow from the issue. Confirm that manifests without provides load successfully and that the Available configs view no longer throws the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100