Skip to content

Conversation

Zozman
Copy link

@Zozman Zozman commented Sep 25, 2025

As mentioned in #3641, currently the endpoints in the express testapp do not work and therefore the documented curl commands do not work as documented in the file's comments. Therefore this PR makes the following changes to fix this:

  • Repairs the context.auth.username check inside the jokeFlow to only perform the check if the object exists (meaning it ran through an endpoint that uses the auth contextProvider and thus doesn't crash if accessed by an endpoint not using the contextProvider).
  • Updates the registration of the POST /jokeFlow endpoint to not rely on iterating through ai.flows because the f.name attribute previously being used does not equal the flow's name anymore so simplifying the logic to ensure it's registered and the curl command works.
  • Moved selection of the model to a selectedModel constant towards the top of the file to allow for easier swapping of the model between providers for make debugging easier.
  • Moved the port of the express server to 8080 because port 5000 is used by Mac OS X Control Center so moved it to make development easier across OSes.

Tested by running the server and executing all the provided curl commands in the comments and calling curl http://localhost:8080/jokeFlow?stream=true -d '{"data": "banana"}' -H "content-type: application/json" -H "authorization: hi" to simulate an authenticated call that fails to ensure that the PERMISSION_DENIED error is properly returned in this usecase.

Checklist (if applicable):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant