btnaughton
btnaughton
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
thanks again
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
got it -- good to know the asgi app is run only
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
also i don't see how to edit the code, but i think that's just basic misunderstanding of marimo!
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
spoke a bit too soon, it dies after a few minutes, with a 401, so i assume it's changing containers or just dropping i tihnk that should be fixable with some kind of timeout or keep_warm or similar at some point modal has to disconnect or it's just a server...
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
ok as far as i can tell it's working 🎈 thanks!!
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
allow_concurrent_inputs=2, seems to fix it??
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
Ah....... thanks! I never would have thought of this. I am seeing the same thing, some kind of blockage. I do not see the POST /api/kernel/instantiate request any more for some reason so maybe it's getting stuck here. Thanks for unsticking me, I'll poke at it more now.
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
also you may be interested that the modal guys are "considering using marimo internally"
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
Thanks! I would be ashamed to admit how much time i've spent trying to get an AI to help figure out authentication here.....
27 replies
Mmarimo
Created by btnaughton on 8/28/2024 in #help-support
running marimo on modal
Here is some example middleware code where I am trying to allow everything (note this is one of several attempts. There is no authorization in the header, but there is marimo-server-token . I can try turning on and off the auth_header check, edit the headers, etc. and no matter how permissive I try to make it, I get the same 401):
def auth_middleware(app):
async def middleware(scope, receive, send):
if scope['type'] == 'http':
headers = dict(scope['headers'])
auth_header = headers.get(b'authorization', b'').decode()
expected_auth = f"Bearer {TOKEN}"

if auth_header != expected_auth:
print(f"Authentication failed. Expected: {expected_auth}, Got: {auth_header}")
await send({
'type': 'http.response.start',
'status': 401,
'headers': [(b'content-type', b'text/plain')]
})
await send({
'type': 'http.response.body',
'body': b'Unauthorized\n'
})
return
await app(scope, receive, send)

return middleware
def auth_middleware(app):
async def middleware(scope, receive, send):
if scope['type'] == 'http':
headers = dict(scope['headers'])
auth_header = headers.get(b'authorization', b'').decode()
expected_auth = f"Bearer {TOKEN}"

if auth_header != expected_auth:
print(f"Authentication failed. Expected: {expected_auth}, Got: {auth_header}")
await send({
'type': 'http.response.start',
'status': 401,
'headers': [(b'content-type', b'text/plain')]
})
await send({
'type': 'http.response.body',
'body': b'Unauthorized\n'
})
return
await app(scope, receive, send)

return middleware
27 replies