Hmm, strange. Can you try this code instead?:
add_action( 'after_setup_theme', function() {
add_image_size( 'hero-image', 500, 500, true );
add_filter( 'generate_hero_thumbnail_id_size', function() {
return 'hero-image';
} );
} );
The first 500
is the width, and the second 500
is the height. That’s where you would input your own width and height depending on what you’re needing.