Skip to content
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

arc.http[.async] in version 7.0.0 are overly strict regarding mixing sync and async middleware #552

Open
alexbepple opened this issue Aug 21, 2023 · 0 comments

Comments

@alexbepple
Copy link

Is your feature request related to a problem? Please describe.

If my handler looks like the following, the arc.http and arc.http.async helpers in version 7.0.0 will complain with

TypeError: All arc.http middleware functions must be async

console logEvent = (event) => {
  console.log(event)
  return event
}

export const handler = arc.http(
  logEvent,

  async () => {
    // do async work
  },
)

However, it would be quite weird to have to turn the above logEvent into an async function.

Describe the solution you'd like
If you want to keep supporting the callback interface, I think it would be best to stick with the API of versions <7. Version 7.0.0 forces me to make functions async that are not async in nature.

Describe alternatives you've considered
An alternative could be to have arc.http be 'smart' the way it currently is in 7.0.0, but arc.http.async to behave the way it did <7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant