AddMarker() error

In trying to add custom markers, I followed the way it was done in the bpmn renderer and maintained the addMarker function unchanged. But there seems to be an error message every time I try to run the source code I get the error message below referring to these lines of code:

var defs = domQuery('defs', canvas._svg);
        if (!defs) {
          defs = svgCreate('defs');
          svgAppend(canvas._svg, defs);
        svgAppend(defs, marker);


Seems to me as an issue with the canvas._svg but I’m not sure and don’t know why that is the case.

Please share a CodeSandbox that reproduces your issue in a way that we can inspect it.

Here is a link

cd modeler
npm install
npm start

For more context, I’m trying to make a custom connector just like the sequence flow. It has an arrow icon on the palette and when I click on it I can select a source element and and a target just as is the case with the global connector tool for example in bpmn-js. Whenever I click on the arrow icon labeled "Custom flow: Draw Include-flow" at the moment I get the above error.

A link to the github folder if sandbox does not work


Here is a working sandbox of the problem and the context is in the previous reply: