Hi! I like the Upstash product and I've used it in my past projects, but now that I'm trying Upstash Workflow, I can't seem to get it working locally.
Here's my code:
import os
from dotenv import load_dotenv
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from upstash_workflow import AsyncWorkflowContext
from upstash_workflow.fastapi import Serve
load_dotenv("../.env.local")
app = FastAPI()
serve = Serve(app)
@serve.post("/hello-world")
async def call(context: AsyncWorkflowContext[str]) -> None:
print("RECEIVED REQUEST")
input = context.request_payload
async def _step1() -> str:
output = "hello1"
print("step 1 input", input, "output", output)
return output
result1: str = await context.run("step1", _step1)
async def _step2() -> str:
output = "hello2"
print("step 2 input", result1, "output", output)
return output
output_step2: str = await context.run("step2", _step2)
print("step 2 output", output_step2)
I'm running Upstash locally using npx @upstash/qstash-cli dev
When I send a request to the hello-world endpoint, all I see printed out is:
RECEIVED REQUEST
INFO: 127.0.0.1:62186 - "POST /hello-world HTTP/1.1" 200 OK
The response is:
{
"workflowRunId": "wfr_pEZC6_EE0iEfiaYPHz00X"
}
In my FastAPI application terminal, I don't see "step 1 input", "step 2 input", or "step 2 output". I also don't see any additional logs on the Upstash terminal when I make requests.
How do I know if step1 or step2 were actually run?
Hi! I like the Upstash product and I've used it in my past projects, but now that I'm trying Upstash Workflow, I can't seem to get it working locally.
Here's my code:
I'm running Upstash locally using
npx @upstash/qstash-cli devWhen I send a request to the
hello-worldendpoint, all I see printed out is:The response is:
In my FastAPI application terminal, I don't see "step 1 input", "step 2 input", or "step 2 output". I also don't see any additional logs on the Upstash terminal when I make requests.
How do I know if
step1orstep2were actually run?