opensearch-project / opensearch-project/flow-framework
[BUG] roleArn is being checked at create time instead of provision time
@junweid62 is already working on this.
Since Dec 17, 2024.
- Dominant language
- Java
- Stars
- 62
- Forks
- 66
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 20
Description
What is the bug?
I am trying to setup a Workflow using the Flow Framework to connect to Claude using the create_connector provision type. I am setting up a variable for the roleArn so that I can inject the actual role when the workflow gets provisioned. Example:
"credential": {
"roleArn": "${{ AWS_BEDROCK_ROLE_ARN }}"
}
When I go to CREATE the workflow using POST _plugins/_flow_framework/workflow, I receive a 502 error. If I replace just the variable placeholder with an actual invalid IAM Role, I get an error that says I'm not authorized to pass that role. This error tells me there the CREATE process is trying to pass a role at CREATE time. This shouldn't be happening, because the Flow Framework template wouldn't know what the role actually is at CREATE time. In this example, the Flow Framework would only know the actual role arn at PROVISION time (_provision). That is when the AWS_BEDROCK_ROLE_ARN would get injected, and would be available to be passed / validated.
How can one reproduce the bug?
You can run the following example workflow in DevTools. This will generate a 502 error because it tries to pass the placeholder variable at CREATE time. Then you can substitute it for an actual AWS Role Arn, like: arn:aws:iam::123456789012:role/MyCoolRole. This will generate a Pass Role error, demonstrating that something is happening at CREATE time that shouldn't be happening. Finally, if you want you can substitute in an actual role that has permissions.
POST _plugins/_flow_framework/workflow
{
"name": "Deploy Claude Model",
"description": "Deploy a model using a connector to Claude",
"use_case": "PROVISION",
"version": {
"template": "1.0.0",
"compatibility": [
"2.12.0",
"3.0.0"
]
},
"workflows": {
"provision": {
"nodes": [
{
"id": "create_claude_connector",
"type": "create_connector",
"user_inputs": {
"name": "Claude Instant Runtime Connector",
"version": "1",
"protocol": "aws_sigv4",
"description": "The connector to BedRock service for Claude model",
"actions": [
{
"headers": {
"x-amz-content-sha256": "required",
"content-type": "application/json"
},
"method": "POST",
"request_body": "{ \"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
"action_type": "predict",
"url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-instant-v1/invoke"
}
],
"credential": {
"roleArn": "${{ AWS_BEDROCK_ROLE_ARN }}"
},
"parameters": {
"endpoint": "https://bedrock-runtime.us-east-1.amazonaws.com/",
"content_type": "application/json",
"auth": "Sig_V4",
"max_tokens_to_sample": "8000",
"service_name": "bedrock",
"temperature": "0.0001",
"response_filter": "$.completion",
"region": "us-east-1",
"anthropic_version": "bedrock-2023-05-31"
}
}
}
]
}
}
}
What is the expected behavior?
The workflow can be provisioned with a placeholder variable in the roleArn section.
What is your host/environment?
Managed OpenSearch 2.13. User that is making the call is configured as an AWS IAM Role in backend security.
Do you have any screenshots?
Do you have any additional context?
n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.