You can’t use attributes that source data from the HTML markup of your block when using Dynamic Blocks. The attribute selector looks at the Save function’s HTML for the attribute, not the Edit function.
You can simply use a type: ‘string’ instead. Hope this helps!