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

Add support for request headers transform in Actions #10482

Open
Li4m-B opened this issue Jul 29, 2024 · 1 comment
Open

Add support for request headers transform in Actions #10482

Li4m-B opened this issue Jul 29, 2024 · 1 comment
Assignees
Labels
c/actions Related to actions c/server Related to server c/v2-engine k/enhancement New feature or improve an existing feature v2-server

Comments

@Li4m-B
Copy link

Li4m-B commented Jul 29, 2024

Is your proposal related to a problem?

I am trying to define an action that calls an external service. This service requires a specific Cookie to be present in the request headers for authentication, which the user should already have at the tame of calling the action.

However, I am not able to figure out a way to pass the cookie value to my webhook handler. I first tried using the Forward client headers to webhook option, but it doesn't seem to forward the Cookie header.

My idea was then to save the cookie token as part of my session variables (which we can do in our authentication service), and use a header transform to forward it to the webhook:

Screenshot 2024-07-29 at 15 28 29
Cookie: {{$session_variables["x-hasura-my-token']}}

It is then that I realized headers transform is not actually supported according to the documentation, resulting in the following error when calling the action:

{
  "errors": [
    {
      "message": "template cannot be resolved: $session_variables[\"x-hasura-my-token']",
      "extensions": {
        "path": "$",
        "code": "not-found"
      }
    }
  ]
}

Describe the solution you'd like

Ideally, it would be great if headers transform could be supported similarly to request body and url to make the above possible.

Describe alternatives you've considered

Alternately, allowing Cookie headers to be forwarded to the webhook could solve this specific use case.

@Li4m-B Li4m-B added the k/enhancement New feature or improve an existing feature label Jul 29, 2024
@manasag manasag added c/server Related to server c/actions Related to actions labels Sep 4, 2024
@rakeshkky
Copy link
Member

rakeshkky commented Sep 4, 2024

Hi @Li4m-B, the header value uses a templating system that only supports interpolation of environment variables. This design choice was established before the introduction of request transformation with Kriti templates. To support Kriti templates in header values, we need to introduce a new key, such as value_from_kriti.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/actions Related to actions c/server Related to server c/v2-engine k/enhancement New feature or improve an existing feature v2-server
Projects
None yet
Development

No branches or pull requests

4 participants