Error in panel after creating new artboard

I have an auto export option that runs in the panel update() method. This works fine until I created a new artboard. Then I get the following error:

Plugin Error: Plugin abc123 is not permitted to make changes from the background. Return a Promise to continue execution asynchronously.
at convertPluginErrorToString (plugins/PluginErrorUtil.js:1:198)
at internalFormatPluginError (plugins/PluginErrorUtil.js:1:1073)
at internalReportPluginError (plugins/PluginErrorUtil.js:1:1180)
at Object.reportPluginError (plugins/PluginErrorUtil.js:1:1612)
at Object.checkAllowedToEdit (plugins/ScenegraphGuard.js:1:1572)
at Artboard. (plugins/ScenegraphWrappers.js:1:12614)
at setSceneNodePluginData (/Users/qamac/Library/Application Support/Adobe/Adobe XD (Prerelease)/develop/myplugin/main.js:1914:21)

Steps

  1. Have panel open
  2. Have method with await call in the update() method. Make sure it works.
  3. Create a new artboard with panel open.

did you use the editDocument method? Any changes to the document requires to be wrapped in this function in the panel world. Docs coming out soon for the general release soon