-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Unable to update elements on Posit Connect #3584
Comments
Something I forgot to note. Nicegui 1.4.8 and fastapi 1.0.8 does not have this problem. |
Strange. Do you see the notification popup when using @ui.page('/')
def index():
ui.button('click me', on_click=lambda: ui.notify('It works!')) Do you see any interesting in the javascript console? |
@aca-trevor-winn What do you mean with FastAPI 1.0.8? Its latest version is 0.112.1. |
No, I just tested and the notify did not work and nothing in the logs except pkg_resource being deprecated
When upgrading nicegui past 1.4.8 it requires fastapi >1.0.8. I was just stating the Fastapi version that was working with the nicegui version I was using. So opening up the consoles network panel I do see a websocket request being sent. I have also checked and onclick events are working. The UI is just not updating for some reason. I apologize for the late response, I posted this right before heading out for the weekend. |
Packages in the environment:
These are the packages in the Posit Environment |
Around version 1.4.8 we had some problems with an incompatibility with FastAPI 0.109.x, see #2354. Could you try upgrading to a newer NiceGUI version, e.g. 1.4.37? Or do you rely on FastAPI 0.108.x? |
What I meant was NiceGUI 1.4.8 DOES work but any version greater than that doesn't. Here is the code I am using to test: from fastapi import FastAPI
from nicegui import ui
app = FastAPI()
def onclick():
print('clicked')
ui.notify('It works!')
@ui.page('/')
def index():
ui.button('click me', on_click=onclick)
ui.run_with(app, storage_secret="secret") The print statement does execute but the notification never shows. This is also true if I make a change to a element and call .update, the element never does update. Here is the manifest file used for Posit: {
"version": 1,
"locale": "English_United States.1252",
"metadata": {
"appmode": "python-fastapi",
"entrypoint": "app"
},
"python": {
"version": "3.11.9",
"package_manager": {
"name": "pip",
"version": "23.1.2",
"package_file": "requirements.txt"
}
},
"files": {
"requirements.txt": {
"checksum": "63586e8f5039bccf552c70317574bae1"
},
"app.py": {
"checksum": "2238ee8f2f6cbf272898617fb579540b"
}
}
}
And here is the requirements.txt that it uses to spin up the environment: nicegui==1.4.37 I am wondering if this update from Posit is part of the issue:
Posit also had breakage due to the Starlette update. UPDATE:
Looks like this Posit Connect update may have broken compatibility?
|
Have you tried setting the And I think you didn't answer my questions from above:
|
I have tried CONNECT_STRICT_ASGI. When set to true it throws errors. I can grab the error log for that if thought necessary. I have not tried updating to 2.0.1, I will do that and report back if anything changes. |
I have tested with Nicegui 2.0.1, with CONNECT_STRICT_ASGI true and false. Here are the logs for CONNECT_STRICT_ASGI true:
Here are the logs for CONNECT_STRICT_ASGI false:
|
Ok, we're out of ideas. This might be a problem specific to Posit Connect. Does anyone from the community have an idea what could be causing the issue? |
I downloaded nicegui source and added it to my test project, I can't use debug on the posit server but I am using print statements to find the source of the incompatibility. The loop for the client inbox is not running it seems, I am investigating further. |
After some testing I have kinda hit a roadblock and could use some guidance. What I have come to terms with is when the Strict Scope path is set the nicegui lifespan context manager never gets called and so the startup operations never fire, like the outbox loop. But when the scope path is set to false, the lifespan DOES work BUT it cant mount the static files. Sorry for the delayed response, I am based on SC and the hurricane moved my priorities. |
The mount version is a bit simpler to maintain and generally faster. But it bypasses FastAPI's routing layer as far as I know. So there might be subtle differences which lead to your error. |
Description
Requirements.txt
Minimal example:
In my local version the word changes to pineapple as expected, but on posit the word does not change. It seems the .update function isn't working possibly?
I am unsure as there are no errors thrown and nothing in the logs.
I have spent about 3 hours googling and trying to debug this, I am hoping I am missing something obvious.
The text was updated successfully, but these errors were encountered: