Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase Functions emulator stops with error when logging a string with an emoji on Windows #8002

Open
lawther opened this issue Nov 28, 2024 · 10 comments

Comments

@lawther
Copy link

lawther commented Nov 28, 2024

[REQUIRED] Environment info

firebase-tools:

PS C:\Users\github> firebase --version
13.27.0

Platform:

Windows 11

[REQUIRED] Test case

Put the following in main.py

from firebase_functions import logger

message = "🐦‍⬛ Blackbird"
logger.log(message)

In case it gets mangled, the UTF-8 of that string is

\xF0\x9F\x90\xA6\xE2\x80\x8D\xE2\xAC\x9B\x20\x42\x6C\x61\x63\x6B\x62\x69\x72\x64

[REQUIRED] Steps to reproduce

Now run the functions emulator with

firebase emulators:start --only functions

[REQUIRED] Expected behavior

The emulator starts up without error. If you remove the emoji from the message string, the emulator starts without error.

[REQUIRED] Actual behavior

An error is logged and the emulator doesn't correctly start

[debug] [2024-11-28T03:29:24.546Z] ----------------------------------------------------------------------
[debug] [2024-11-28T03:29:24.549Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\XXXXXX\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js emulators:start --only functions --debug
[debug] [2024-11-28T03:29:24.549Z] CLI Version:   13.27.0
[debug] [2024-11-28T03:29:24.550Z] Platform:      win32
[debug] [2024-11-28T03:29:24.550Z] Node Version:  v20.12.2
[debug] [2024-11-28T03:29:24.550Z] Time:          Thu Nov 28 2024 14:29:24 GMT+1100 (Australian Eastern Daylight Time)
[debug] [2024-11-28T03:29:24.550Z] ----------------------------------------------------------------------
[debug] 
[debug] [2024-11-28T03:29:24.690Z] Object "" in "firebase.json" has unknown property: {"additionalProperty":"flutter"}
[debug] [2024-11-28T03:29:24.698Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2024-11-28T03:29:24.699Z] > authorizing via signed-in user ([email protected])
[info] i  emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
[debug] [2024-11-28T03:29:24.707Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T03:29:24.707Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}]},"metadata":{"message":"assigned listening specs for emulators"}}
[debug] [2024-11-28T03:29:24.713Z] [hub] writing locator at C:\Users\XXXXXX\AppData\Local\Temp\hub-XXXXXX.json
[debug] [2024-11-28T03:29:24.734Z] Checked if tokens are valid: true, expires at: 1732766630140
[debug] [2024-11-28T03:29:24.734Z] Checked if tokens are valid: true, expires at: 1732766630140
[debug] [2024-11-28T03:29:24.736Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX [none]
[debug] [2024-11-28T03:29:25.276Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX 200
[debug] [2024-11-28T03:29:25.276Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX {"projectId":"XXXXXX","projectNumber":"751502879957","displayName":"XXXXXX","name":"projects/XXXXXX","resources":{"hostingSite":"XXXXXX"},"state":"ACTIVE","etag":"XXXXXX"}
[debug] [2024-11-28T03:29:25.281Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T03:29:25.282Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T03:29:25.282Z] [tasks] Cloud Tasks Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T03:29:25.282Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}],"tasks":[{"address":"127.0.0.1","family":"IPv4","port":9499}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}
[warn] !  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: apphosting, auth, firestore, database, hosting, pubsub, storage, dataconnect {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mapphosting, auth, firestore, database, hosting, pubsub, storage, dataconnect\u001b[22m"}}
[debug] [2024-11-28T03:29:25.286Z] defaultcredentials: writing to file C:\Users\XXXXXX\AppData\Roaming\firebase\XXXXXX_gmail.com_application_default_credentials.json
[debug] [2024-11-28T03:29:25.287Z] Setting GAC to C:\Users\XXXXXX\AppData\Roaming\firebase\XXXXXX_gmail.com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to C:\\Users\\XXXXXX\\AppData\\Roaming\\firebase\\XXXXXX_gmail.com_application_default_credentials.json"}}
[debug] [2024-11-28T03:29:25.288Z] Checked if tokens are valid: true, expires at: 1732766630140
[debug] [2024-11-28T03:29:25.288Z] Checked if tokens are valid: true, expires at: 1732766630140
[debug] [2024-11-28T03:29:25.289Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig [none]
[debug] [2024-11-28T03:29:25.666Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig 200
[debug] [2024-11-28T03:29:25.667Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig {"projectId":"XXXXXX","storageBucket":"XXXXXX.firebasestorage.app"}
[info] i  functions: Watching "C:\Users\XXXXXX\github\XXXXXX\functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\" for Cloud Functions..."}}
[debug] [2024-11-28T03:29:25.703Z] Customer code is not Node
[debug] [2024-11-28T03:29:25.704Z] Validating python source
[debug] [2024-11-28T03:29:25.704Z] Building python source
[info] i  functions: Loaded environment variables from .env. 
[debug] [2024-11-28T03:29:25.707Z] Could not find functions.yaml. Must use http discovery
[debug] [2024-11-28T03:29:25.718Z] Running command with virtualenv: command="C:\Users\XXXXXX\github\XXXXXX\functions\venv\Scripts\activate.bat", args=["","&&","python.exe","-c","\"import firebase_functions; import os; print(os.path.dirname(firebase_functions.__file__))\""]
[debug] [2024-11-28T03:29:25.812Z] stdout: C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions

[debug] [2024-11-28T03:29:25.818Z] Running admin server with args: ["python.exe","\"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\private\\serving.py\""] and env: {"GCLOUD_PROJECT":"XXXXXX","K_REVISION":"1","PORT":"80","GOOGLE_CLOUD_QUOTA_PROJECT":"XXXXXX","FUNCTIONS_EMULATOR":"true","TZ":"UTC","FIREBASE_DEBUG_MODE":"true","FIREBASE_DEBUG_FEATURES":"{\"skipTokenVerification\":true,\"enableCors\":true}","FIREBASE_EMULATOR_HUB":"127.0.0.1:4400","CLOUD_EVENTARC_EMULATOR_HOST":"http://127.0.0.1:9299","CLOUD_TASKS_EMULATOR_HOST":"127.0.0.1:9499","FIREBASE_CONFIG":"{\"storageBucket\":\"XXXXXX.firebasestorage.app\",\"projectId\":\"XXXXXX\"}","GOOGLE_APPLICATION_CREDENTIALS":"C:\\Users\\XXXXXX\\AppData\\Roaming\\firebase\\XXXXXX_gmail.com_application_default_credentials.json","ADMIN_PORT":"8081"} in C:\Users\XXXXXX\github\XXXXXX\functions
[debug] [2024-11-28T03:29:25.819Z] Running command with virtualenv: command="C:\Users\XXXXXX\github\XXXXXX\functions\venv\Scripts\activate.bat", args=["","&&","python.exe","\"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\private\\serving.py\""]
[info]  * Serving Flask app 'serving'
 * Debug mode: off

[error] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8081

[error] Press CTRL+C to quit

[error] [2024-11-28 03:29:27,230] ERROR in app: Exception on /__/functions.yaml [GET]
Traceback (most recent call last):
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\private\serving.py", line 122, in get_functions_yaml
    functions = get_functions()
                ^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\private\serving.py", line 40, in get_functions
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\Users\XXXXXX\github\XXXXXX\functions\main.py", line 4, in <module>
    logger.log(message)
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 112, in log
    write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))
  File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 97, in write
    print(_json.dumps(_remove_circular(entry), ensure_ascii=False),
  File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>

[debug] [2024-11-28T03:29:27.234Z] Got response code 500; body <!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

[error] 127.0.0.1 - - [28/Nov/2024 03:29:27] "GET /__/functions.yaml HTTP/1.1" 500 -

[error] 127.0.0.1 - - [28/Nov/2024 03:29:27] "GET /__/quitquitquit HTTP/1.1" 200 -

[error] !!  functions: Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error"}}
[debug] [2024-11-28T03:29:27.256Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[info] 
┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
 
[debug] [2024-11-28T03:29:30.968Z] Received signal SIGINT (Ctrl-C) 1
[info]  
[info] i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown. 
[info] i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now. 
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[info] i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
[info] i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
[info] i  eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
[info] i  tasks: Stopping Cloud Tasks Emulator {"metadata":{"emulator":{"name":"tasks"},"message":"Stopping Cloud Tasks Emulator"}}
[info] i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[info] i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[debug] [2024-11-28T03:29:30.980Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
@google-oss-bot
Copy link
Contributor

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@lawther
Copy link
Author

lawther commented Nov 28, 2024

Done!

@aalej
Copy link
Contributor

aalej commented Nov 28, 2024

Thanks for creating a detailed report @lawther! Currently, I'm unable to reproduce this on a macOS machine, which makes me think that this issue might be specific to Windows. I'll try to get access to a Windows machine, or ask someone from our team to test this out.

A couple of questions here - What version of the firebase_functions library are you using? You can check this in the requirements.txt file. Also, if you run a function that uses an emoji, something similar to below, do you also encounter a similar error?

from firebase_functions import https_fn

@https_fn.on_request()
def on_request_example(req: https_fn.Request) -> https_fn.Response:
   message = "🐦‍⬛ Blackbird"
   return https_fn.Response("Hello world!" + message)

@lawther
Copy link
Author

lawther commented Nov 28, 2024

Hi @aalej ,

Thanks for responding. In answer to your questions:

  • Version of firebase_functions is 0.4.2
(venv) PS C:\Users\> py -m pip freeze | Select-String "firebase-functions"
firebase-functions==0.4.2
  • Inside a function. Logging fails, but that example you posted works OK.

If I use your example, and visit http://localhost:5001/XXXXXX/us-central1/on_request_example, I correctly see "Hello world!🐦‍⬛ Blackbird" in the browser.

However, if I change your sample code to add a log statement

from firebase_functions import https_fn
from firebase_functions import logger

@https_fn.on_request()
def on_request_example(req: https_fn.Request) -> https_fn.Response:
    message = "🐦‍⬛ Blackbird"
    logger.log(message)
    return https_fn.Response("Hello world!" + message)

Then I get

500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

This is why I think the error is in the logging function. I originally encountered the problem when logging from a function, however I reduced it to the minimal repro I posted above.

Here is the debug log:

[debug] [2024-11-28T21:01:24.006Z] ----------------------------------------------------------------------
[debug] [2024-11-28T21:01:24.010Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\XXXXXX\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js emulators:start --only functions --debug
[debug] [2024-11-28T21:01:24.010Z] CLI Version:   13.27.0
[debug] [2024-11-28T21:01:24.011Z] Platform:      win32
[debug] [2024-11-28T21:01:24.011Z] Node Version:  v20.12.2
[debug] [2024-11-28T21:01:24.011Z] Time:          Fri Nov 29 2024 08:01:24 GMT+1100 (Australian Eastern Daylight Time)
[debug] [2024-11-28T21:01:24.011Z] ----------------------------------------------------------------------
[debug]
[debug] [2024-11-28T21:01:24.139Z] Object "" in "firebase.json" has unknown property: {"additionalProperty":"flutter"}
[debug] [2024-11-28T21:01:24.147Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2024-11-28T21:01:24.147Z] > authorizing via signed-in user (XXXXXX)
[info] i  emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
[debug] [2024-11-28T21:01:24.156Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T21:01:24.156Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}]},"metadata":{"message":"assigned listening specs for emulators"}}
[debug] [2024-11-28T21:01:24.162Z] [hub] writing locator at C:\Users\XXXXXX\AppData\Local\Temp\hub-XXXXXX.json
[debug] [2024-11-28T21:01:24.182Z] Checked if tokens are valid: true, expires at: 1732830083414
[debug] [2024-11-28T21:01:24.184Z] Checked if tokens are valid: true, expires at: 1732830083414
[debug] [2024-11-28T21:01:24.185Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX [none]
[debug] [2024-11-28T21:01:24.953Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX 200
[debug] [2024-11-28T21:01:24.953Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX {"projectId":"XXXXXX","projectNumber":"751502879957","displayName":"productivity-ai","name":"projects/XXXXXX","resources":{"hostingSite":"XXXXXX"},"state":"ACTIVE","etag":"XXXXXX"}
[debug] [2024-11-28T21:01:24.959Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T21:01:24.960Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T21:01:24.960Z] [tasks] Cloud Tasks Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-28T21:01:24.960Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}],"tasks":[{"address":"127.0.0.1","family":"IPv4","port":9499}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}
[warn] !  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: apphosting, auth, firestore, database, hosting, pubsub, storage, dataconnect {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mapphosting, auth, firestore, database, hosting, pubsub, storage, dataconnect\u001b[22m"}}
[debug] [2024-11-28T21:01:24.965Z] defaultcredentials: writing to file C:\Users\XXXXXX\AppData\Roaming\firebase\XXXXXX_gmail.com_application_default_credentials.json
[debug] [2024-11-28T21:01:24.969Z] Setting GAC to C:\Users\XXXXXX\AppData\Roaming\firebase\XXXXXX_gmail.com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to C:\\Users\\XXXXXX\\AppData\\Roaming\\firebase\\XXXXXX_gmail.com_application_default_credentials.json"}}
[debug] [2024-11-28T21:01:24.970Z] Checked if tokens are valid: true, expires at: 1732830083414
[debug] [2024-11-28T21:01:24.970Z] Checked if tokens are valid: true, expires at: 1732830083414
[debug] [2024-11-28T21:01:24.971Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig [none]
[debug] [2024-11-28T21:01:25.584Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig 200
[debug] [2024-11-28T21:01:25.584Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX/adminSdkConfig {"projectId":"XXXXXX","storageBucket":"XXXXXX.firebasestorage.app"}
[info] i  functions: Watching "C:\Users\XXXXXX\github\XXXXXX\functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\" for Cloud Functions..."}}
[debug] [2024-11-28T21:01:25.644Z] Customer code is not Node
[debug] [2024-11-28T21:01:25.645Z] Validating python source
[debug] [2024-11-28T21:01:25.645Z] Building python source
[info] i  functions: Loaded environment variables from .env.
[debug] [2024-11-28T21:01:25.648Z] Could not find functions.yaml. Must use http discovery
[debug] [2024-11-28T21:01:25.659Z] Running command with virtualenv: command="C:\Users\XXXXXX\github\XXXXXX\functions\venv\Scripts\activate.bat", args=["","&&","python.exe","-c","\"import firebase_functions; import os; print(os.path.dirname(firebase_functions.__file__))\""]
[debug] [2024-11-28T21:01:25.766Z] stdout: C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions

[debug] [2024-11-28T21:01:25.775Z] Running admin server with args: ["python.exe","\"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\private\\serving.py\""] and env: {"GCLOUD_PROJECT":"XXXXXX","K_REVISION":"1","PORT":"80","GOOGLE_CLOUD_QUOTA_PROJECT":"XXXXXX","FUNCTIONS_EMULATOR":"true","TZ":"UTC","FIREBASE_DEBUG_MODE":"true","FIREBASE_DEBUG_FEATURES":"{\"skipTokenVerification\":true,\"enableCors\":true}","FIREBASE_EMULATOR_HUB":"127.0.0.1:4400","CLOUD_EVENTARC_EMULATOR_HOST":"http://127.0.0.1:9299","CLOUD_TASKS_EMULATOR_HOST":"127.0.0.1:9499","FIREBASE_CONFIG":"{\"storageBucket\":\"XXXXXX.firebasestorage.app\",\"projectId\":\"XXXXXX\"}","GOOGLE_APPLICATION_CREDENTIALS":"C:\\Users\\XXXXXX\\AppData\\Roaming\\firebase\\XXXXXX_gmail.com_application_default_credentials.json","ADMIN_PORT":"8081"} in C:\Users\XXXXXX\github\XXXXXX\functions
[debug] [2024-11-28T21:01:25.776Z] Running command with virtualenv: command="C:\Users\XXXXXX\github\XXXXXX\functions\venv\Scripts\activate.bat", args=["","&&","python.exe","\"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\private\\serving.py\""]
[info]  * Serving Flask app 'serving'
 * Debug mode: off

[error] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8081

[error] Press CTRL+C to quit

[error] 127.0.0.1 - - [28/Nov/2024 21:01:27] "GET /__/functions.yaml HTTP/1.1" 200 -

[debug] [2024-11-28T21:01:27.112Z] Got response from /__/functions.yaml endpoints:
  on_request_example:
    availableMemoryMb: null
    concurrency: null
    entryPoint: on_request_example
    httpsTrigger: {}
    ingressSettings: null
    labels: {}
    maxInstances: null
    minInstances: null
    platform: gcfv2
    secretEnvironmentVariables: []
    serviceAccountEmail: null
    timeoutSeconds: null
params: []
requiredAPIs: []
specVersion: v1alpha1

[error] 127.0.0.1 - - [28/Nov/2024 21:01:27] "GET /__/quitquitquit HTTP/1.1" 200 -

[info] +  functions: Loaded functions definitions from source: on_request_example. {"metadata":{"emulator":{"name":"functions"},"message":"Loaded functions definitions from source: on_request_example."}}
[info] +  functions[us-central1-on_request_example]: http function initialized (http://127.0.0.1:5001/XXXXXX/us-central1/on_request_example). {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mhttp\u001b[22m function initialized (http://127.0.0.1:5001/XXXXXX/us-central1/on_request_example)."}}
[debug] [2024-11-28T21:01:27.155Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[info]
┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4000/               │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.

[debug] [2024-11-28T21:01:33.232Z] [work-queue] {"queuedWork":["/XXXXXX/us-central1/on_request_example-2024-11-28T21:01:33.232Z"],"queueLength":1,"runningWork":[],"workRunningCount":0}
[debug] [2024-11-28T21:01:33.233Z] [work-queue] {"queuedWork":[],"queueLength":0,"runningWork":["/XXXXXX/us-central1/on_request_example-2024-11-28T21:01:33.232Z"],"workRunningCount":1}
[debug] [2024-11-28T21:01:33.235Z] Accepted request GET /XXXXXX/us-central1/on_request_example --> us-central1-on_request_example
[debug] [2024-11-28T21:01:33.241Z] [functions] Runtime ready! Sending request! {"metadata":{"emulator":{"name":"functions"},"message":"[functions] Runtime ready! Sending request!"}}
[debug] [2024-11-28T21:01:33.243Z] [functions] Got req.url=/XXXXXX/us-central1/on_request_example, mapping to path=/ {"metadata":{"emulator":{"name":"functions"},"message":"[functions] Got req.url=/XXXXXX/us-central1/on_request_example, mapping to path=/"}}
[info] i  functions: Loaded environment variables from .env.
[debug] [2024-11-28T21:01:33.266Z] Running command with virtualenv: command="C:\Users\XXXXXX\github\XXXXXX\functions\venv\Scripts\activate.bat", args=["","&&","functions-framework"]
[debug] [2024-11-28T21:01:33.279Z] [worker-pool] addWorker(us-central1-on_request_example) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(us-central1-on_request_example)"}}
[debug] [2024-11-28T21:01:33.281Z] [worker-pool] Adding worker with key us-central1-on_request_example, total=1 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key us-central1-on_request_example, total=1"}}
[info] >   * Serving Flask app 'on_request_example'
 {"user":" * Serving Flask app 'on_request_example'\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m  * Serving Flask app 'on_request_example'\r"}}
[info] >   * Debug mode: off
 {"user":" * Debug mode: off\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m  * Debug mode: off\r"}}
[info] >  WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 {"user":"WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\r"}}
[info] >   * Running on http://127.0.0.1:8117
 {"user":" * Running on http://127.0.0.1:8117\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m  * Running on http://127.0.0.1:8117\r"}}
[info] >  Press CTRL+C to quit
 {"user":"Press CTRL+C to quit\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m Press CTRL+C to quit\r"}}
[info] >  [2024-11-28 21:01:34,369] ERROR in app: Exception on /__/health [GET]
 {"user":"[2024-11-28 21:01:34,369] ERROR in app: Exception on /__/health [GET]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m [2024-11-28 21:01:34,369] ERROR in app: Exception on /__/health [GET]\r"}}
[info] >  Traceback (most recent call last):
 {"user":"Traceback (most recent call last):\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m Traceback (most recent call last):\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 1473, in wsgi_app\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 1473, in wsgi_app\r"}}
[info] >      response = self.full_dispatch_request()
 {"user":"    response = self.full_dispatch_request()\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     response = self.full_dispatch_request()\r"}}
[info] >                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 882, in full_dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 882, in full_dispatch_request\r"}}
[info] >      rv = self.handle_user_exception(e)
 {"user":"    rv = self.handle_user_exception(e)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     rv = self.handle_user_exception(e)\r"}}
[info] >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 880, in full_dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 880, in full_dispatch_request\r"}}
[info] >      rv = self.dispatch_request()
 {"user":"    rv = self.dispatch_request()\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     rv = self.dispatch_request()\r"}}
[info] >           ^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"         ^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m          ^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 865, in dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 865, in dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 865, in dispatch_request\r"}}
[info] >      return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
 {"user":"    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\functions_framework\execution_id.py", line 106, in wrapper
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\execution_id.py\", line 106, in wrapper\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\execution_id.py\", line 106, in wrapper\r"}}
[info] >      return view_function(*args, **kwargs)
 {"user":"    return view_function(*args, **kwargs)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return view_function(*args, **kwargs)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\functions_framework\__init__.py", line 142, in view_func
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\__init__.py\", line 142, in view_func\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\__init__.py\", line 142, in view_func\r"}}
[info] >      return function(request._get_current_object())
 {"user":"    return function(request._get_current_object())\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return function(request._get_current_object())\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\https_fn.py", line 447, in on_request_wrapped
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\https_fn.py\", line 447, in on_request_wrapped\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\https_fn.py\", line 447, in on_request_wrapped\r"}}
[info] >      return _core._with_init(func)(request)
 {"user":"    return _core._with_init(func)(request)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return _core._with_init(func)(request)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\core.py", line 125, in wrapper
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\core.py\", line 125, in wrapper\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\core.py\", line 125, in wrapper\r"}}
[info] >      return fn(*args, **kwargs)
 {"user":"    return fn(*args, **kwargs)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return fn(*args, **kwargs)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\main.py", line 34, in on_request_example
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\main.py\", line 34, in on_request_example\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\main.py\", line 34, in on_request_example\r"}}
[info] >      logger.log(message)
 {"user":"    logger.log(message)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     logger.log(message)\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 112, in log
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 112, in log\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 112, in log\r"}}
[info] >      write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))
 {"user":"    write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 97, in write
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 97, in write\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 97, in write\r"}}
[info] >      print(_json.dumps(_remove_circular(entry), ensure_ascii=False),
 {"user":"    print(_json.dumps(_remove_circular(entry), ensure_ascii=False),\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     print(_json.dumps(_remove_circular(entry), ensure_ascii=False),\r"}}
[info] >    File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 19, in encode
 {"user":"  File \"C:\\Users\\XXXXXX\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\encodings\\cp1252.py\", line 19, in encode\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\encodings\\cp1252.py\", line 19, in encode\r"}}
[info] >      return codecs.charmap_encode(input,self.errors,encoding_table)[0]
 {"user":"    return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >  UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>
 {"user":"UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>\r"}}
[debug] [2024-11-28T21:01:34.400Z] [worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: IDLE {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"[worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: IDLE"}}
[debug] [2024-11-28T21:01:34.400Z] [worker-pool] submitRequest(triggerId=us-central1-on_request_example) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitRequest(triggerId=us-central1-on_request_example)"}}
[info] i  functions: Beginning execution of "us-central1-on_request_example" {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"Beginning execution of \"us-central1-on_request_example\""}}
[debug] [2024-11-28T21:01:34.401Z] [worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: BUSY {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"[worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: BUSY"}}
[info] >  127.0.0.1 - - [28/Nov/2024 21:01:34] "GET /__/health HTTP/1.1" 500 -
 {"user":"127.0.0.1 - - [28/Nov/2024 21:01:34] \"GET /__/health HTTP/1.1\" 500 -\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m 127.0.0.1 - - [28/Nov/2024 21:01:34] \"GET /__/health HTTP/1.1\" 500 -\r"}}
[info] >  [2024-11-28 21:01:34,404] ERROR in app: Exception on / [GET]
 {"user":"[2024-11-28 21:01:34,404] ERROR in app: Exception on / [GET]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m [2024-11-28 21:01:34,404] ERROR in app: Exception on / [GET]\r"}}
[info] >  Traceback (most recent call last):
 {"user":"Traceback (most recent call last):\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m Traceback (most recent call last):\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 1473, in wsgi_app\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 1473, in wsgi_app\r"}}
[info] >      response = self.full_dispatch_request()
 {"user":"    response = self.full_dispatch_request()\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     response = self.full_dispatch_request()\r"}}
[info] >                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 882, in full_dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 882, in full_dispatch_request\r"}}
[info] >      rv = self.handle_user_exception(e)
 {"user":"    rv = self.handle_user_exception(e)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     rv = self.handle_user_exception(e)\r"}}
[info] >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 880, in full_dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 880, in full_dispatch_request\r"}}
[info] >      rv = self.dispatch_request()
 {"user":"    rv = self.dispatch_request()\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     rv = self.dispatch_request()\r"}}
[info] >           ^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"         ^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m          ^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\flask\app.py", line 865, in dispatch_request
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 865, in dispatch_request\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\flask\\app.py\", line 865, in dispatch_request\r"}}
[info] >      return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
 {"user":"    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\functions_framework\execution_id.py", line 106, in wrapper
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\execution_id.py\", line 106, in wrapper\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\execution_id.py\", line 106, in wrapper\r"}}
[info] >      return view_function(*args, **kwargs)
 {"user":"    return view_function(*args, **kwargs)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return view_function(*args, **kwargs)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\functions_framework\__init__.py", line 142, in view_func
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\__init__.py\", line 142, in view_func\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\functions_framework\\__init__.py\", line 142, in view_func\r"}}
[info] >      return function(request._get_current_object())
 {"user":"    return function(request._get_current_object())\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return function(request._get_current_object())\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\https_fn.py", line 447, in on_request_wrapped
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\https_fn.py\", line 447, in on_request_wrapped\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\https_fn.py\", line 447, in on_request_wrapped\r"}}
[info] >      return _core._with_init(func)(request)
 {"user":"    return _core._with_init(func)(request)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return _core._with_init(func)(request)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\core.py", line 125, in wrapper
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\core.py\", line 125, in wrapper\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\core.py\", line 125, in wrapper\r"}}
[info] >      return fn(*args, **kwargs)
 {"user":"    return fn(*args, **kwargs)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return fn(*args, **kwargs)\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\main.py", line 34, in on_request_example
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\main.py\", line 34, in on_request_example\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\main.py\", line 34, in on_request_example\r"}}
[info] >      logger.log(message)
 {"user":"    logger.log(message)\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     logger.log(message)\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 112, in log
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 112, in log\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 112, in log\r"}}
[info] >      write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))
 {"user":"    write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     write(_entry_from_args(LogSeverity.NOTICE, *args, **kwargs))\r"}}
[info] >    File "C:\Users\XXXXXX\github\XXXXXX\functions\venv\Lib\site-packages\firebase_functions\logger.py", line 97, in write
 {"user":"  File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 97, in write\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\github\\XXXXXX\\functions\\venv\\Lib\\site-packages\\firebase_functions\\logger.py\", line 97, in write\r"}}
[info] >      print(_json.dumps(_remove_circular(entry), ensure_ascii=False),
 {"user":"    print(_json.dumps(_remove_circular(entry), ensure_ascii=False),\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     print(_json.dumps(_remove_circular(entry), ensure_ascii=False),\r"}}
[info] >    File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 19, in encode
 {"user":"  File \"C:\\Users\\XXXXXX\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\encodings\\cp1252.py\", line 19, in encode\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m   File \"C:\\Users\\XXXXXX\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\encodings\\cp1252.py\", line 19, in encode\r"}}
[info] >      return codecs.charmap_encode(input,self.errors,encoding_table)[0]
 {"user":"    return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m     return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r"}}
[info] >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 {"user":"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r"}}
[info] >  UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>
 {"user":"UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m UnicodeEncodeError: 'charmap' codec can't encode characters in position 35-37: character maps to <undefined>\r"}}
[debug] [2024-11-28T21:01:34.417Z] Finishing up request with event=pause {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"Finishing up request with event=pause"}}
[info] i  functions: Finished "us-central1-on_request_example" in 16.6473ms {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"Finished \"us-central1-on_request_example\" in 16.6473ms"}}
[debug] [2024-11-28T21:01:34.418Z] [worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: IDLE {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"[worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: IDLE"}}
[debug] [2024-11-28T21:01:34.419Z] Finishing up request with event=finish {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"Finishing up request with event=finish"}}
[debug] [2024-11-28T21:01:34.419Z] Finishing up request with event=close {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"Finishing up request with event=close"}}
[debug] [2024-11-28T21:01:34.419Z] [work-queue] {"queuedWork":[],"queueLength":0,"runningWork":[],"workRunningCount":0}
[info] >  127.0.0.1 - - [28/Nov/2024 21:01:34] "GET / HTTP/1.1" 500 -
 {"user":"127.0.0.1 - - [28/Nov/2024 21:01:34] \"GET / HTTP/1.1\" 500 -\r","metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"\u001b[90m> \u001b[39m 127.0.0.1 - - [28/Nov/2024 21:01:34] \"GET / HTTP/1.1\" 500 -\r"}}
[debug] [2024-11-28T21:01:37.305Z] Received signal SIGINT (Ctrl-C) 1
[info]
[info] i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
[info] i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[info] i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
[info] i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
[info] i  eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
[info] i  tasks: Stopping Cloud Tasks Emulator {"metadata":{"emulator":{"name":"tasks"},"message":"Stopping Cloud Tasks Emulator"}}
[info] i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[debug] [2024-11-28T21:01:37.316Z] [worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: exited {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"[worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: exited"}}
[debug] [2024-11-28T21:01:37.316Z] [worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: FINISHED {"metadata":{"emulator":{"name":"functions"},"function":{"name":"us-central1-on_request_example"},"extension":{},"message":"[worker-us-central1-on_request_example-1ad1b239-8c94-453a-b0f4-b92e952523c0]: FINISHED"}}
[info] i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[debug] [2024-11-28T21:01:37.320Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.

@lawther
Copy link
Author

lawther commented Nov 28, 2024

Also, if I try simply using the log function outside the emulator with a simple test script:

from firebase_functions import logger

message = "🐦‍⬛ Blackbird"
print(message)
logger.log(message)

I get the expected output

(venv) PS C:\Users\github\> py --version
Python 3.12.6
(venv) PS C:\Users\github\> py .\test.py
🐦‍⬛ Blackbird
{"severity": "NOTICE", "message": "🐦‍⬛ Blackbird"}

In the console I actually see the non-merged emoji of 🐦‍ followed by ⬛, but when pasting here it merges to 🐦‍⬛. But regardless, no error.

@aalej
Copy link
Contributor

aalej commented Dec 9, 2024

Thanks for the additional information, and apologies for the delay. I got a Windows machine to test this on and was able to reproduce the error. I'll raise this to our engineering team and mark this as reproducible. Sharing the mcve here.

@CorieW
Copy link

CorieW commented Dec 13, 2024

Hey @lawther

This looks like a character encoding issue. On macOS, terminals typically use UTF-8 encoding by default, so that's likely why @aalej didn't encounter any problems there. However, on Windows, the terminal might use a Windows code page, such as cp1250 or cp1252 (depending on your region and language settings), which can cause issues when handling Unicode characters.

To fix this, you can explicitly set the standard output encoding to UTF-8. Does the following work for you?

from firebase_functions import https_fn
from firebase_functions import logger
import sys

# Set UTF-8 encoding
sys.stdout.reconfigure(encoding="utf-8")

@https_fn.on_request()
def on_request_example(req: https_fn.Request) -> https_fn.Response:
    logger.info("🐦‍⬛ Blackbird")
    return https_fn.Response("Ok")

@lawther
Copy link
Author

lawther commented Dec 14, 2024

Hey @CorieW ,

Thanks for the reply. I'm away from my dev environment for the next few days, but I'll try your suggestion when I get back.

In terms of Python and the Windows console, as you can see from an earlier comment of mine #8002 (comment) I can successfully use both the native Python print function and the Firebase logging functions from Python on Windows without starting the emulator. So I suspect the problem lies somewhere in how the emulator sets up the logging output on Windows. I haven't read enough of the code to know whether it's Python or Java that does the outputting once the emulator is started.

@CorieW
Copy link

CorieW commented Dec 16, 2024

I've confirmed that this issue doesn't occur when using JavaScript Firebase Functions. I'll have a look into Python Firebase Functions later this week to see if I can get it to automatically use UTF-8. For now, sys.stdout.reconfigure(encoding="utf-8") can probably be used to get around this.

@CorieW
Copy link

CorieW commented Dec 16, 2024

Nevermind, I looked into it today and figured out the issue. The problem was caused by character encoding defaulting to cp... (cp1252 on my machine) when starting Python with the JVM (such as the emulator). This issue doesn't occur with Node.js when started with the JVM (for JS Firebase Functions). I'll submit a PR to firebase-functions-python soon to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants