Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!
Your download will start shortly. If your download does not begin, click here to retry.
Error Troubleshooting
Error Message - Uncaught TypeError: Cannot read properties of null (reading ‘appendChild’) or Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’.
Symptom:
You may see the following errors when you open your application. These errors may be sporadic or may halt your application.
-
Uncaught TypeError: Cannot read properties of null (reading ‘appendChild’)
-
Uncaught TypeError: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’
Cause:
Typically, an application uses DWTObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer') to create the object at the target container. There are certain conditions where Dynamic Web TWAIN’s initialization process will complete, but after initialization, the target container is not defined or remains null. You will then see the error when trying to upload your files.
Workaround:
Please check if your container is created dynamically (especially if you are using dynamic frameworks). There are two ways to address the issue.
(1) If you want to use the dynamic initialization method, first disable auto-loading in dynamsoft.webtwain.config.js by setting both Dynamsoft.DWT.AutoLoad = false and Dynamsoft.DWT.Containers = []. Otherwise, the auto-loading process can race with your own CreateDWTObjectEx() call and create the exact container-not-ready condition described above. Once auto-loading is disabled, here is sample code to create the object dynamically once your container is confirmed to exist:
Dynamsoft.DWT.CreateDWTObjectEx(
{
WebTwainId: 'myDWT'
},
function(obj) {
DWTObject = obj;
DWTObject.Viewer.bind(document.getElementById('dwtcontrolContainer'));
DWTObject.Viewer.height = 400;
DWTObject.Viewer.width = 600;
DWTObject.Viewer.show();
},
function(err) {
console.log(err);
}
);
(2) If you want to use the default initialization method instead, set Dynamsoft.DWT.AutoLoad to false and manually call Dynamsoft.DWT.Load() once you’ve confirmed the container has been created.
Original post creation date: Dec 27, 2022
Last modified date: Jul 29, 2026