2

I'm trying to create an S3 ECL Provider...But I'm not sure how to create the connection. I'm on .NET Framework 4.5.2 and SDL Web8.1

I have two possible ways:

1)

AmazonS3Config config = new AmazonS3Config()
{
      ServiceURL = serviceUrl,
};

S3 = new AmazonS3Client(
      mountpointConfig.Element(S3AccessId).Value,
      mountpointConfig.Element(S3SecretKey).Value,
      amazonS3Config
);

2)

        AmazonS3Client S3 = new Amazon.S3.AmazonS3Client(
        config.Element(S3BucketName).Value,
        config.Element(S3SecretKey).Value,
        config.Element(S3AccessId).Value)            
        config.Element(FullBucketUrl).Value
        );

I'm trying to follow the article here but there are errors and empty gaps...like

In S3Item.cs I see something that seems to be a constructor but named S3MediaSet, Is that intended to be a constructor (and should be named S3Item) or a method that should have return type?

Also in S3Provider I don’t get S3 propery (in Initialize method) of what type is it, AmazonS3Client? If so then S3Content.GetViewItemUrl has a call to S3Provider.S3.GetMediaUrl which doesn’t exist in AmazonS3Client.

Does someone has a complete sample code on how to create an S3 ECL Provider for Tridion that can share please?

Thanks in advance.

UPDATE

This is the log I'm getting

2017-07-19 16:29:38,960 [37] DEBUG UI.DataExtenders - Process response for command 'GetListActivityInstances' id='' 2017-07-19 16:29:38,960 [37] DEBUG UI.DataExtenders - Updating element 'tcm:ListActivityInstances' 2017-07-19 16:29:42,621 [37] DEBUG UI.DataExtenders - Process request for command 'GetList' id='tcm:0-287-1' 2017-07-19 16:29:43,379 [37] DEBUG UI.DataExtenders - Process responce for command 'GetList' id='tcm:0-287-1' 2017-07-19 16:29:46,219 [36] DEBUG UI.DataExtenders - Process request for command 'GetList' id='ecl:287-s3-root-mp-mountpoint' 2017-07-19 16:29:46,715 [37] DEBUG UI.DataExtenders - Process request for command 'GetList' id='ecl:287-s3-root-mp-mountpoint' 2017-07-19 16:29:46,755 [37] ERROR UI.Model - System.Exception: Unable to get the list of items ---> System.ServiceModel.FaultException1[System.ServiceModel.ExceptionDetail]: Failed initializing the External Content Library with id s3. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Tridion.ExternalContentLibrary.Service.Client.ISessionAwareEclService.GetList(String parentItemUri, Int32 pageIndex, EclItemTypes itemTypes, IEnumerable1 basedOnSchema) at Tridion.ExternalContentLibrary.UI.Model.Services.GeneralImpl.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) --- End of inner exception stack trace --- at Tridion.ExternalContentLibrary.UI.Model.Services.GeneralImpl.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) at Tridion.ExternalContentLibrary.UI.Model.Services.General.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) at SyncInvokeGetList(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Tridion.Web.UI.Core.Extensibility.DataExtenderOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) 2017-07-19 16:29:46,756 [36] ERROR UI.Model - System.Exception: Unable to get the list of items ---> System.ServiceModel.FaultException1[System.ServiceModel.ExceptionDetail]: Failed initializing the External Content Library with id s3. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Tridion.ExternalContentLibrary.Service.Client.ISessionAwareEclService.GetList(String parentItemUri, Int32 pageIndex, EclItemTypes itemTypes, IEnumerable1 basedOnSchema) at Tridion.ExternalContentLibrary.UI.Model.Services.GeneralImpl.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) --- End of inner exception stack trace --- at Tridion.ExternalContentLibrary.UI.Model.Services.GeneralImpl.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) at Tridion.ExternalContentLibrary.UI.Model.Services.General.GetList(String id, Int32 pageIndex, Filter filter, Int32 columns) at SyncInvokeGetList(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Tridion.Web.UI.Core.Extensibility.DataExtenderOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) 2017-07-19 16:29:47,125 [36] DEBUG UI.DataExtenders - Process response for command 'GetListActivityInstances' id='' 2017-07-19 16:29:47,125 [36] DEBUG UI.DataExtenders - Updating element 'tcm:ListActivityInstances' 2017-07-19 16:29:53,854 [36] DEBUG UI.DataExtenders - Process response for command 'GetListActivityInstances' id='' 2017-07-19 16:29:53,854 [36] DEBUG UI.DataExtenders - Updating element 'tcm:ListActivityInstances'

15
  • Hi Polonnskyg- the S3Item.cs does not have constructor and does not need one. S3 class is sample model class with some properties. I would see if I can share the code somehwere.. the code in blog is just to make understanding on how it works. Commented Jul 20, 2017 at 7:43
  • Hi @VikasKumar thx for replying...Our main problem now is that after creating the mountpoint we're getting: ERROR UI.Model - System.Exception: Unable to get the list of items ---> System.ServiceModel.FaultException1[System.ServiceModel.ExceptionDetail]: Failed initializing the External Content Library with id s3. Any idea what might be it?
    – polonskyg
    Commented Jul 20, 2017 at 11:48
  • @VikasKumar And regarding the S3Item.cs, you have this ** public S3MediaSet(IEclUri ecluri, S3Info info) : base(ecluri, info) ** but I don't get that base(ecluri, info) , since it's inheriting from classes that doesn't have S3MediaSet method
    – polonskyg
    Commented Jul 20, 2017 at 12:25
  • 1
    Look at the code here - github.com/vikaskumar185/S3ECLProvider Commented Jul 21, 2017 at 6:40
  • 1
    @VikasKumar Working! I needed to specify Amazon.EndpointRegion in the AmazonS3Client constructor. Thx!!! One question..Is this test code that I can use and play with or Is it any licensing?
    – polonskyg
    Commented Jul 21, 2017 at 18:09

1 Answer 1

0

Seems the discussion on the question has given bit of clarity, but for sake of answer I would put below points:

  1. Make sure you have proper connection to S3
  2. Use the code and help from here
  3. Code works fine so focus on debugging first when you see error.
4
  • Do you know if there is any number of items that above that number is really slow? We've tried with 400 files (less than 40KB each) and is really slow, like 30 seconds at least to bring them)
    – polonskyg
    Commented Jul 27, 2017 at 20:14
  • Well for 400 or more it might be unless you enumerate them. Try using enumerated methods to get in call list and use pagination. If you have read my blog I have mentioned keeping 100 images at least about to it per folder makes it faster, however you do what you need to do, so use enumeration. Commented Jul 27, 2017 at 21:40
  • one last question, When in S3.cs, method public S3Info GetMediaInfo(IEclUri eclUri) is called with a folder s3Obj = s3Client.GetObject(request); throws key not found (it does work for files. Do you know why?
    – polonskyg
    Commented Aug 4, 2017 at 20:19
  • Because files and folders in aws acts as key. There are no such concepts of file and directories in aws, you actually interpret them based on trailing '/' slash. So method takes key and that key could be anything. Commented Aug 22, 2017 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.