Object.keys()
used on undefined or null values.The "TypeError: Cannot convert undefined or null to object" error in Webflow is typically caused by custom JavaScript that's trying to manipulate or access a value that hasn't been defined—or is null
—when your code expects an object.
tag and Inside tag for any custom scripts.
Object.keys(...)
, Object.assign(...)
, or Object.entries(...)
—these methods throw this error if the passed value is null
or undefined
.undefined
or null
Is Being Used ImproperlyObject.keys(myVar)
and myVar
is not set yet, it will trigger this error.document.querySelector('.some-element').addEventListener(...)
will fail if .some-element
doesn’t exist. To prevent this, use a check:/contact
on /about
.The "TypeError: Cannot convert undefined or null to object"
error in Webflow is almost always caused by custom JavaScript trying to access object methods on values that are not defined. Focus on auditing your custom scripts, ensure they only run when needed, and always check for the existence of objects or DOM elements before manipulating them.