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

ModuleNotFoundError: No module named 'util' #162

Closed
lubaspc opened this issue Nov 15, 2023 · 5 comments · Fixed by #168
Closed

ModuleNotFoundError: No module named 'util' #162

lubaspc opened this issue Nov 15, 2023 · 5 comments · Fixed by #168
Labels
waiting for customer response Issue is on hold awaiting more information from OP

Comments

@lubaspc
Copy link

lubaspc commented Nov 15, 2023

File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/functions_framework/init.py", line 174, in view_func
function(event)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/alerts/crashlytics_fn.py", line 295, in crashlytics_decorator_wrapped
from firebase_functions.private._alerts_fn import crashlytics_event_from_ce
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/private/_alerts_fn.py", line 19, in
import util as _util
ModuleNotFoundError: No module named 'util'

@lubaspc
Copy link
Author

lubaspc commented Nov 15, 2023

change
import util as _util
for
import firebase_functions.private.util as _util

@exaby73
Copy link
Contributor

exaby73 commented Dec 4, 2023

Hey. Could you provide me with some example code and also which version of firebase_functions you're using?

@exaby73 exaby73 added the waiting for customer response Issue is on hold awaiting more information from OP label Dec 4, 2023
@lubaspc
Copy link
Author

lubaspc commented Dec 20, 2023

I am using version 0.2.0

_alerts_fn.py file

import typing as _typing
import cloudevents.http as _ce
import util as _util
from firebase_functions.alerts import FirebaseAlertData

from functions_framework import logging as _logging

change for

import firebase_functions.private.util as _util

LeslieLeung added a commit to LeslieLeung/firebase-functions-python that referenced this issue Jan 8, 2024
@LeslieLeung
Copy link
Contributor

Hi, I made a pr #168 to fix this, but I don't know who to assign to. @exaby73 Can you have a look?

@LeslieLeung
Copy link
Contributor

FYI, here is a code example.

import firebase_functions.alerts.crashlytics_fn as crashlytics_fn
from firebase_admin import initialize_app
import requests

initialize_app()


@crashlytics_fn.on_velocity_alert_published()
def on_velocity_alert_published(alert):
    alert_handle(alert)

def alert_handle(alert):
    # some curl code with requests

And the error log:

[2024-01-08 05:51:47,013] ERROR in app: Exception on / [POST]
Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app response = self.full_dispatch_request()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/functions_framework/__init__.py", line 178, in view_func
function(event)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/alerts/crashlytics_fn.py", line 295, in crashlytics_decorator_wrapped
from firebase_functions.private._alerts_fn import crashlytics_event_from_ce
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/private/_alerts_fn.py", line 19, in <module>
import util as _util
ModuleNotFoundError: No module named 'util'

@exaby73 exaby73 linked a pull request Jan 15, 2024 that will close this issue
exaby73 pushed a commit that referenced this issue Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for customer response Issue is on hold awaiting more information from OP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants