Magento 2.3 Inject helper into controller object type error?
Just Remove the Generation folder or in version 2.2 remove the generated folder.
rm -rf generated/
Flush the cache. It should work then. Its because the interceptor file needs to be re-created or refresh.
You have an issue at __construct(
.
You must pass the context object \Magento\Framework\App\Action\Context $context
to the
parent class Magento\Framework\App\Action\Action
public function __construct(
\Magento\Framework\App\Action\Context $context,
CustomHelper $helper
) {
$this->helper = $helper;
parent::__construct($context);
}
after these changes, when in developer mode, just remove the folders under var/generation/ or generated/ as the documentation suggests
or run setup:di:compile when in production mode