Code Monkey home page Code Monkey logo

Comments (6)

berengamble avatar berengamble commented on May 28, 2024 1

It's probably the healthcheck. To deal with it, I just put this in my https functions:

    if req.method == "GET" and req.path == "/__/health":
        logger.debug("Returning OK to healthcheck")
        return https_fn.Response("OK")

If it's not that, print req.path to find out what it is.

from firebase-functions-python.

exaby73 avatar exaby73 commented on May 28, 2024 1

@ekalosak Sorry if I misunderstood the issue, but does #134 fix this issue? Seems unrelated to me.

If indeed the issue is this extra GET request triggering the warning log with the None request body, we should probably either try to fix that or if it's not something we can control, at least document it. The PR is still valid, just not sure if this issue should be considered fixed once that's merged in

from firebase-functions-python.

exaby73 avatar exaby73 commented on May 28, 2024

Hello @ekalosak. Could you provide a minimal reproducible example as well as your python version and contents of your requirements.txt?

from firebase-functions-python.

ekalosak avatar ekalosak commented on May 28, 2024

@exaby73 That strikes me as correct.

The next line above in the stack trace is:

/.../venv/lib/python3.11/site-packages/firebase_functions/private/util.py", line 125, in _on_call_valid_
method
>      _logging.warning("Request has invalid method.", request.method)

While I believe you are quite right that #134 will not fix the reported error, I believe the fix is something quite similar. The offending line is in the same util.py.

minimal reproducible example

python -c 'import logging; logging.warning("won't work", ("GET",))'

expected result

--- Logging error ---
Traceback (most recent call last):
  File "/.../3.11.4/lib/python3.11/logging/__init__.py", line 1110, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/.../3.11.4/lib/python3.11/logging/__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/.../3.11.4/lib/python3.11/logging/__init__.py", line 687, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "/.../3.11.4/lib/python3.11/logging/__init__.py", line 377, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
  File "<string>", line 1, in <module>
Message: 'asdf'
Arguments: (('GET',),)

Notice that string coercion fails for tuples.

So that's an easy fix of course, just extract the string value from the 1-tuple request.method and 🚀


Regarding the GET request - as berengamble says above that seems likely to be a desirable health check. The desired behavior, I imagine, aught not to be to remove the health check but instead to fix the error in the utility that logs such requests.

from firebase-functions-python.

ekalosak avatar ekalosak commented on May 28, 2024

Fix: #138

from firebase-functions-python.

ekalosak avatar ekalosak commented on May 28, 2024

Fixed by merge of #138 .

from firebase-functions-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.