[QLDB] Unable to create QLDB Stream in .NET
See original GitHub issueI am getting an error creating a QLDB Stream from CDK using .NET. The CfnStream class requires a InclusiveStartTime property of type string, which is a UTC date in ISO8601 format. ex: 2019-11-05T13:15:30Z.
I am using the following code to get to this format but I have also tried specifying a regular string in the correct format. It didn’t work either.
InclusiveStartTime = $"{DateTime.UtcNow.ToString("s")}Z"
This is the exception I am getting.
Unhandled exception. Amazon.JSII.Runtime.JsiiException: Resolution error: System.ArgumentException: Value has unexpected token type Date (Parameter 'value')
I tried replicating the same CDK stack using TypeScript and it worked.
Reproduction Steps
namespace Cdk
{
public class MyStack : Stack
{
internal MyStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
CfnLedger qldb = new CfnLedger(this, "myLedger", new CfnLedgerProps{
Name = "myLedger",
PermissionsMode = "ALLOW_ALL"
});
Role QldbToKinesisRole = new Role(this, "qldbToKinesisRole", new RoleProps{
RoleName = "QldbToKinesisRole",
AssumedBy = new ServicePrincipal("qldb.amazonaws.com")
});
QldbToKinesisRole.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("AmazonKinesisFullAccess"));
Stream qldbStream = new Stream(this, "qldbStream", new StreamProps{
StreamName = "MyKinesisStream",
ShardCount = 1
});
Amazon.CDK.AWS.QLDB.CfnStream qldbStreamConfig = new Amazon.CDK.AWS.QLDB.CfnStream(this, "qldbStreamConfig", new Amazon.CDK.AWS.QLDB.CfnStreamProps{
LedgerName = "myLedger",
StreamName = "MyKinesisStream",
InclusiveStartTime = $"{DateTime.UtcNow.ToString("s")}Z",
RoleArn = QldbToKinesisRole.RoleArn,
KinesisConfiguration = new Amazon.CDK.AWS.QLDB.CfnStream.KinesisConfigurationProperty{
AggregationEnabled = true,
StreamArn = qldbStream.StreamArn
}
});
}
}
}
What did you expect to happen?
I expected the cdk deploy command to succeed.
What actually happened?
Unhandled exception. Amazon.JSII.Runtime.JsiiException: Resolution error: System.ArgumentException: Value has unexpected token type Date (Parameter 'value')
at Amazon.JSII.Runtime.Services.Converters.JsiiToFrameworkConverter.InferType(IReferenceMap referenceMap, Object value)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.ConvertAny(Type type, IReferenceMap referenceMap, Object value)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertPrimitive(Type type, IReferenceMap referenceMap, Object value, Boolean isOptional, PrimitiveType primitiveType, Object& result)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, Type type, IReferenceMap referenceMap, Object value, Object& result)
at Amazon.JSII.Runtime.Services.Converters.JsiiToFrameworkConverter.TryConvertMap(IReferenceMap referenceMap, TypeReference elementTypeInstance, Object value, Object& result)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvertCollection(IReferenceMap referenceMap, Object value, Boolean isOptional, CollectionTypeReference collectionType, Object& result)
at Amazon.JSII.Runtime.Services.Converters.ValueConverter.TryConvert(IOptionalValue optionalValue, Type type, IReferenceMap referenceMap, Object value, Object& result)
at Amazon.JSII.Runtime.CallbackExtensions.<>c__DisplayClass2_0.<InvokeMethod>b__0(Int32 n)
at System.Linq.Enumerable.SelectRangeIterator`1.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Amazon.JSII.Runtime.CallbackExtensions.InvokeMethod(InvokeRequest request, IReferenceMap referenceMap)
at Amazon.JSII.Runtime.CallbackExtensions.InvokeCallbackCore(Callback callback, IReferenceMap referenceMap)
at Amazon.JSII.Runtime.CallbackExtensions.InvokeCallback(Callback callback, IReferenceMap referenceMap, IFrameworkToJsiiConverter converter, String& error).
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
at Amazon.JSII.Runtime.Services.Client.Invoke(InvokeRequest request)
at Amazon.JSII.Runtime.Services.Client.Invoke(ObjectReference objectReference, String method, Object[] arguments)
at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass17_0`1.<InvokeInstanceMethod>b__1(IClient client, Object[] args)
at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_0`1& )
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func`3 beginFunc, Func`3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Type[] parameterTypes, Object[] arguments, String methodName)
at Amazon.CDK.Stage.Synth(IStageSynthesisOptions options)
at Cdk.Program.Main(String[] args) in /Users/tiagobar/Documents/GitHub/eventsourcing-qldb/cdk/src/Cdk/Program.cs:line 14
Subprocess exited with error 134
Environment
- CLI Version : aws-cli/2.0.34 Python/3.7.4 Darwin/19.6.0 botocore/2.0.0dev38
- Framework Version: 1.64.0 (build 9510201)
- OS : MacOs
- Language (Version): netcoreapp3.1
Other
I see that there are other issues that seem related to this one 7392 and 5317
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Stream permissions in QLDB - Amazon Quantum Ledger ...
Complete the following steps to create a permissions policy for a QLDB stream. This example shows a Kinesis Data Streams policy that grants...
Read more >Streaming data from Amazon QLDB to Elasticsearch
For this, I look to build on the previous post and stream data from QLDB into Amazon Elasticsearch (ES). To try this out...
Read more >Building System of Record Applications with Amazon QLDB
Amazon QLDB is a new class of database that provides a transparent, immutable, and cryptographically verifiable transaction log. Join us in this tech...
Read more >Building out a serverless application with Amazon QLDB
Amazon QLDB is a centralized ledger database that supports many use cases for when you need a complete, immutable history of all data ......
Read more >Blockchain | AWS re:Post
ManagedBlockchain Copy cert file from S3 - failinglg. ... I created a QLDB stream with console But the record data contains unreadable characters...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My assumption was confirmed and I am looking to release the fix today 🎉
I see you got around this quickly! So my answer might not be that important anymore, but yes, we also use .NET.
Since the problem occurred during synthesis, we ended up doing this in the stack file:
and ended
Program.Main
withand that worked for us.