# Uncaught (in promise) TypeError: Cannot read properties of undefined

**URL:** <https://forum.bpmn.io/t/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined/11067>\
**Category:** Modeler\
**Created:** [May 25, 2024, 3:42pm UTC](https://forum.bpmn.io/t/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined/11067 "2024-05-25T15:42:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navein\_Kumar](https://forum.bpmn.io/user_avatar/forum.bpmn.io/navein_kumar/32/5416_2.png) [@Navein\_Kumar](https://forum.bpmn.io/u/Navein_Kumar)\
**Post date:** [May 25, 2024, 3:42pm UTC](https://forum.bpmn.io/t/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined/11067/1 "2024-05-25T15:42:45Z")

</div>

I am trying to improve the property panel of the camunda modeler to add a custom component, when I plugin the code and run the code I get the error in the SpellProps.js file while using TextFieldEntry with the error :

hooks.module.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘context’)  
at q (hooks.module.js:1:1551)  
at useError (index.esm.js:436:17)  
at b.TextfieldEntry [as constructor] (index.esm.js:4244:1)  
at b.O [as render] (preact.module.js:1:1)  
at L (preact.module.js:1:1)  
at C (preact.module.js:1:1)  
at L (preact.module.js:1:1)  
at C (preact.module.js:1:1)  
at L (preact.module.js:1:1)  
at C (preact.module.js:1:1)

My contents of SpellProps.js file :

import { TextFieldEntry, isTextFieldEntryEdited } from ‘@bpmn-io/properties-panel’;  
import { is } from ‘bpmn-js/lib/util/ModelUtil’;

import { html } from ‘htm/preact’;  
import { debounce } from ‘min-dash’;

export default function(element, modeling, translate) {

return [  
{  
id: ‘spell’,  
element,  
modeling:modeling,  
translate:translate,  
isEdited: isTextFieldEntryEdited,  
component: Spell

```
}

```

];  
}

function Spell(props) {  
const { element, id, modeling,translate} = props;  
[//console.log](https://console.log)(modeling)  
//const modeling = useService(‘modeling’);  
//const translate = useService(‘translate’);  
//const debounce = useService(‘debounceInput’);

const getValue = () =\> {  
return element.businessObject.spell || ‘’;  
};

const setValue = (value) =\> {  
return modeling.updateProperties(element, {  
spell: value  
});  
};

console.log(id,element,translate,getValue,setValue,debounce)

return html`<${TextFieldEntry} id=${ id } element=${ element } description=${ translate('Apply a black magic spell') } label=${ translate('Spell') } getValue=${ getValue } setValue=${ setValue } debounce=${ debounce } tooltip=${ translate('Check available spells in the spellbook.') } />`  
}

And i referred the following repo : [bpmn-js-examples/properties-panel-extension at main · bpmn-io/bpmn-js-examples · GitHub](https://github.com/bpmn-io/bpmn-js-examples/tree/main/properties-panel-extension)

can someone help me here

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [July 9, 2025, 10:10am UTC](https://forum.bpmn.io/t/uncaught-in-promise-typeerror-cannot-read-properties-of-undefined/11067/2 "2025-07-09T10:10:42Z")

</div>

Closed on July 9, 2025, 10:10am UTC

Closing old topics.
