Closed kumkee closed 1 year ago
@abdelhai agrees to investigate into the issue. I am reopening it.
Hey @kumkee, sorry for the delay in response. I see that you are trying to use custom run commands for your Python app on Space.
As said here, as of now the Python runtime on Space does not support custom run commands, but we are working on adding this feature in the near future. In the meantime, your app must be an instance of ASGI or WSGI (like FastAPI or Flask) with the app instance named app
, when running on the Python runtime. Take a look at this for reference.
Creating a new event loop and setting it as the current event loop seems to have solved the problem:
import asyncio
# rest of the code
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
Please try this and let us know if this resolves your issue :)
@mikBighne98, thank you.
as of now the Python runtime on Space does not support custom run commands
I didn't intent to run
commands under the python3.9
engine. It was an experiment with the SuperTokens team in an attempt to solve my problem.
The default branch has now been rolled back to the state without those custom commands or run sections.
Creating a new event loop and setting it as the current event loop seems to have solved the problem:
The suggested code is added under the asynico branch.
Both cases still give me errors:
Error Type:
Runtime.ExitError
Error Message:
RequestId: b1a5c903-8fde-4a3a-921a-7079ee1985ed Error: Runtime exited with error: exit status 127
Logs:
time="2023-03-15T18:26:19Z" level=info msg="serving logs listener on sandbox.localdomain:1234" agent=logsApiAgent
TELEMETRY Name: telemetry-extension State: Subscribed Types: [Function]
/opt/bootstrap: does not exist
The live app is with the asyncio branch at the moment.
I just redeployed using the exact same source code of backend under the asyncio branch. Just commented this and replaced the API keys and client secret with random strings as I don't have those. And it successfully deployed and returned {"message":"Hello World"}
when I accessed the endpoint. I don't see anything wrong in your Spacefile also. Make sure you're deploying the source code from the right branch and if it still persists try to change the micro name maybe. But do let us know :)
... replaced the API keys and client secret with random strings as I don't have those. And it successfully deployed and returned
{"message":"Hello World"}
...
With random keys, python would ignore the init(...)
part I guess, which has been the cause of the problem.
Let me publicise (or share with you) the secret file later today (I'm going away from my PC).
With successfully running the init()
part, you would be able to access the /auth/dashboard
path of the endpoint as well.
... replaced the API keys and client secret with random strings as I don't have those. And it successfully deployed and returned
{"message":"Hello World"}
...With random keys, python would ignore the
init(...)
part I guess, which has been the cause of the problem. Let me publicise (or share with you) the secret file later today (I'm going away from my PC). With successfully running theinit()
part, you would be able to access the/auth/dashboard
path of the endpoint as well.
@mikBighne98 The secret keys are now published.
Very weirdly, I can no longer push to the project. space-cli says Error: failed to push code, unauthorized
. Is it because you are using it as well?
Now it works! https://stks-1-n8187335.deta.app/auth/dashboard
Unless you want to find out why the old space-project corrupts, we can close the issue! - by the way, is there a way to delete a space-projet?
Error: Runtime exited with error: exit status 127
indicates the possibility of corruption on the cloud endThere is no current event loop in thread 'MainThread'.
error can be solved with the following
import asyncio
# rest of the code
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
Unless you want to find out why the old space-project corrupts, ...
I guess this is worth opening another issue but doesn't concern me as a user. All I hope is that you consider adding these to your future version of your documentation as well. I am closing the issue now.
Thank you @mikBighne98, @abdelhai and the rest of the Deta team. Although it is in beta with some problems, your support makes my experience with Deta Space more enjoyable.
Thanks a lot for your kind words, @kumkee. We are actively working on fixing these issues and improving the deployment process.
Unless you want to find out why the old space-project corrupts
We have received several reports regarding this. We are investigating the cause and will try to resolve it as soon as possible.
By the way, is there a way to delete a space-project?
As of now, there is no way to delete a project, but we plan to add this feature in the near future.
In your documentation, you mentioned
I am trying to build a backend connecting SuperTokens' core. It works with local uvicorn but not on Space. Here is the issue I filed on SuperTokens. Can you look into that as well, please?
Summary of what I wrote there:
uvicorn
but has its own global server, which might be causing the issue.Which Repo?
Since you don't host your server code here on GitHub, I don't know which repo of yours to report my issue to. It is about how your engine works so I am posting it here in your documentation. Let me know if there is somewhere else more appropriate.