The Magento 2 bug "widget.getProductId is not a function" is causing you problems? Read this blog post to learn the solution.
The Magento updates are excellent!
They come with lots of new features and performance improvements. However, on rare occasions they could malfunction due to minor flaws or clash with third-party extensions. One such problem that retailers are now dealing with following the update of their stores to Magento 2.4.2 is the widget. The product page indicates that widget.getProductId is not a Function in Magento 2.
Numerous Magento store owners have complained about this issue, where the product page displays an error similar to the one above rather than the product information. Such an error could have a detrimental effect on the customer's experience at the store by preventing them from researching the products and, subsequently, the sales. In order to avoid losing out on profitable sales, it is essential to find a solution as quickly as feasible.
Source: https://meetanshi.com/blog/solution-to-widget-getproductid-is-not-a-function-error-in-magento-2/