Hi Matt Hargenrader,
For the ConverseStream, the service in the builder should be 'bedrock' (as you have it). This leads to the host being generated as 'https://bedrock.us-east-1.amazonaws.com', however ConverseStream needs to have the host 'https://bedrock-runtime.us-east-1.amazonaws.com' So you could overwrite the $SigV4Headers/Host you are using in the REST call with 'https://bedrock-runtime.us-east-1.amazonaws.com'.
Please let me know if this solved your problem.
Best regards,
Daan
Hi Daan,
Thank you for your response and feedback.
I was in contact with someone from the Mendix team, and they advised the same thing and to set up the SigV4Builder as follows:
When I followed the above implementation, coupled with overwriting the Host header in the REST activity, the 403 Forbidden (i.e., signature mismatch) error was seemingly resolved, but I did receive a 400 Bad Request error instead.
This recommended solution makes sense, but I think something else is causing the signature mismatch error. If you look at the Java source code for the GetSigV4Headers action within the AWS Authentication module, the Host header is calculated as follows:
The getSubDomain method actually defaults to the ServiceName value if the SubDomain member is either null or empty, as seen below:
With this in mind, it seems the proper approach is to add the SubDomain member to the SigV4Builder (i.e., "bedrock-runtime"), which properly calculates the Host header, but as stated previously, this still results in a 403 Forbidden error.
Please let me know if you have any other ideas.
Best regards,
Matt
Hi ,
Are you able to resolve this issue. If yes , please give me the details how it was. I am also facing this same issue. But I am able to execute Retrieve API , but not Invoke and converse APIs.
I encountered a similar issue and managed to resolve it.
The request worked in Postman because Postman automatically handles AWS Signature Version 4 signing. I inspected the request using the Postman console and noticed that the Host header sent by Postman differed from the one generated by the Mendix Java action GetSigV4Headers.
In AWS SigV4, the Host header is not just a regular HTTP header—it is one of the signed headers used to generate the signature included in the Authorization header. If the Host value used during signature generation does not match the actual Host header sent in the request, AWS will reject the request with a 403 SignatureDoesNotMatch error.
Therefore, it's not sufficient to simply set the correct Host header in the REST API call. You must ensure that the exact same value is used during signature generation. This is especially important when using proxies, custom endpoints, or when the request is routed differently than expected.
Solution:
1. Make a copy of the Java action GetSigV4Headers you're using to generate the headers.
2. Edit the method getHost(String awsRegionString) in the Java action to return the correct Host value identified from postman.
Java code before and after:
Before
After
This ensures that the signature generated by your Java action matches what AWS expects, avoiding signature mismatch errors.