'Deployment of GCP's Google Functions not possible, returning an empty error

I am new to GCP and just trying to work with deployment of my first Google Functions. Initially I tried to deploy the most basic default function, one that's being loaded automatically by GCP with 'Hello World'. However when deploying it deployment fails and I am returned with empty error message, id, types etc. (see below)

Deployment failure: Build failed:

{
    "metrics": {},
    "error": {
        "buildpackId": "",
        "buildpackVersion": "",
        "errorType": "OK",
        "canonicalCode": "OK",
        "errorId": "",
        "errorMessage": ""
    },
    "stats": [
        {
            "buildpackId": "google.utils.archive-source",
            "buildpackVersion": "0.0.1",
            "totalDurationMs": 35,
            "userDurationMs": 35
        },
        {
            "buildpackId": "google.python.functions-framework",
            "buildpackVersion": "0.9.6",
            "totalDurationMs": 74,
            "userDurationMs": 74
        },
        {
            "buildpackId": "google.python.pip",
            "buildpackVersion": "0.9.2",
            "totalDurationMs": 7589,
            "userDurationMs": 7580
        },
        {
            "buildpackId": "google.utils.label",
            "buildpackVersion": "0.0.2",
            "totalDurationMs": 0,
            "userDurationMs": 0
        }
    ],
    "warnings": null,
    "customImage": false
}

Can anyone advise on what might go wrong here?

Edit: Adding source of code for refference:

def hello_world(request):
    """Responds to any HTTP request.
    Args:
        request (flask.Request): HTTP request object.
    Returns:
        The response text or any set of values that can be turned into a
        Response object using
        `make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
    """
    request_json = request.get_json()
    if request.args and 'message' in request.args:
        return request.args.get('message')
    elif request_json and 'message' in request_json:
        return request_json['message']
    else:
        return f'Hello World!'


Solution 1:[1]

That code appears truncated and should look alike this:

from flask import escape
import functions_framework

@functions_framework.http
def hello_world(request):
...

Unless annotating with @functions_framework.http, there is no HTTP Cloud Function.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1