You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This starts up as expected:
```
* Serving Flask app 'hello_get' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://localhost:18000
Press CTRL+C to quit
* Restarting with watchdog (fsevents)
* Debugger is active!
* Debugger PIN: 104-682-644
```
Make a change that introduces a syntax error, and you get:
* Detected change in '/Users/david/src/opvia/app/scripts_v3/cloud_function/main.py', reloading
* Restarting with watchdog (fsevents)
Traceback (most recent call last):
File "/Users/david/src/opvia/app/.venv/bin/functions-framework", line 8, in <module>
sys.exit(_cli())
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/functions_framework/_cli.py", line 37, in _cli
app = create_app(target, source, signature_type)
File "/Users/david/src/opvia/app/.venv/lib/python3.10/site-packages/functions_framework/__init__.py", line 289, in create_app
spec.loader.exec_module(source_module)
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/david/src/opvia/app/scripts_v3/cloud_function/main.py", line 11
///
^^
SyntaxError: invalid syntax
and the process exits
Potential solution:
Apparently this used to be an issue in Flask, but isn't anymore (see https://stackoverflow.com/a/68445450 ). I did some digging to work out how they fixed it, and I think I have a solution:
I think that functions-framework basically needs to do something like this:
Steps to reproduce:
This starts up as expected:
``` * Serving Flask app 'hello_get' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on http://localhost:18000 Press CTRL+C to quit * Restarting with watchdog (fsevents) * Debugger is active! * Debugger PIN: 104-682-644 ```Make a change that introduces a syntax error, and you get:
and the process exits
Potential solution:
Apparently this used to be an issue in Flask, but isn't anymore (see https://stackoverflow.com/a/68445450 ). I did some digging to work out how they fixed it, and I think I have a solution:
I think that functions-framework basically needs to do something like this:
https://github.com/pallets/flask/pull/4718/files#diff-fed8939d1905b99bba605ad91e9ccdf5ede6223e03ccbc3f0121853035051e62R935-R950
in functions_framework/init.py", line 289, in create_app where it does:
The text was updated successfully, but these errors were encountered: