How to require files in a custom endpoint

From the wp_die() reference,

$args
(string|array|int) (Optional) Arguments to control behavior. If $args is an integer, then it is treated as the response code.

response
(int) The HTTP response code. Default 200 for Ajax requests, 500 otherwise.

So your REST API endpoint returns the error 500 because that’s the default header status sent by the wp_die function.

And I recommend you to return a proper value — e.g. a WP_Error instance on error, or a WP_REST_Response instance on success. Try these variations and compare the responses:

Option 1

// Works, but with a 500 status code.
function uploadFileFE() {
    wp_die();
}

Option 2

// Works, but shouldn't be used unless the client is *not* expecting a JSON response.
function uploadFileFE() {
    echo 'foo';
}

Option 3

// I'd use this. WordPress will apply rest_ensure_response() to the returned value.
function uploadFileFE() {
    return 'foo';
    //return WP_REST_Response( 'foo' ); // or use this, or below to send an error..
    //return new WP_Error( 'invalid_file', 'Invalid file!', array( 'status' => 400 ) );
}