flogo icon indicating copy to clipboard operation
flogo copied to clipboard

Error: github.com/project-flogo/legacybridge] - interface conversion: interface {} is nil, not string

Open neethuabacker opened this issue 4 years ago • 18 comments

Current behavior (how does the issue manifest): I am working on open source Amazon S3 connector which throws me an error when connecting to S3 that says : github.com/project-flogo/legacybridge] - interface conversion: interface {} is nil, not string I raised a case against the connector, but I am told that its related to legacybridge changes. Please see this issue: https://github.com/retgits/flogo-components/issues/15

Expected behavior:

Minimal steps to reproduce the problem (not required if feature enhancement):

Please tell us about your environment (Operating system, docker version, browser & web ui version, etc):

Flogo version (CLI & contrib/lib. If unknown, leave empty or state unknown): 0.X.X Flogo v0.9.2 Additional information you deem important (e.g. issue happens only occasionally): https://github.com/retgits/flogo-components/issues/15 has all additional information including app json file

neethuabacker avatar Nov 13 '19 19:11 neethuabacker

Can you share the error logs once again?

Thanks.

skothari-tibco avatar Nov 13 '19 20:11 skothari-tibco

sure, attached flogolog.txt

neethuabacker avatar Nov 13 '19 20:11 neethuabacker

just noticed there is another error too: InvalidEndpointURL: invalid endpoint uri caused by: parse https://s3.US East (N. Virginia).amazonaws.com/{Bucket}/{Key+}: invalid character " " in host name github.com/project-flogo/core/support/log.(*zapLoggerImpl).Errorf. How is it building the https:// endpoint?

neethuabacker avatar Nov 13 '19 21:11 neethuabacker

The HTTPS endpoint for the S3 Activity is built by the AWS Go SDK. It uses the identifier of the region (like us-west-2) and not the name itself. So the region in line 83 has to be set according to the regions specified by AWS. In your case, US East (N. Virginia) should be us-east-1

retgits avatar Nov 13 '19 21:11 retgits

@neethuabacker the error, it seems to me that, it's coming from activity. https://github.com/retgits/flogo-components/blob/master/activity/amazons3/activity.go#L56 , this one in particular. There's no localLocation in the JSON. And thus interface conversion is nil not string. @mellistibco should we add s3 activity in project-flogo/aws-contrib . Edit with aws-contrib not the original one.

skothari-tibco avatar Nov 13 '19 21:11 skothari-tibco

@skothari-tibco there is a localLocation in the JSON 😉 https://github.com/retgits/flogo-components/blob/master/activity/amazons3/activity.json#L48

retgits avatar Nov 13 '19 21:11 retgits

I meant in the flogo json.

skothari-tibco avatar Nov 13 '19 21:11 skothari-tibco

Ah okay 😄 just out of curiosity, does the legacybridge try to parse every field even if they're optional?

retgits avatar Nov 13 '19 21:11 retgits

yes, i have same question, was typing it :) why for optional fields I have to provide values..

neethuabacker avatar Nov 13 '19 21:11 neethuabacker

also, just fyi. i got that {} nil error on a timer where I did not give a frequency interval too, when frequency is optional. something is not right. ( then i changed my code to http trigger to get past it )

neethuabacker avatar Nov 13 '19 21:11 neethuabacker

I think it's just with the old contributions. The legacy bridge passes the context with the values provided in the JSON to the legacy activity.If there's no value associated with it, it passes {}. This https://github.com/project-flogo/legacybridge/blob/master/activity.go#L151 shows a small snippet.

With the new contributions if it's optional, it's fine if you don't have it.

skothari-tibco avatar Nov 13 '19 21:11 skothari-tibco

The old version (0.5.x) would return nil if an optional param was not specified, so technically the behavior is the same... So the coerce to a string in the activity would be causing an issue... Even the tests for the activity set localLocation to an empty string, rather than not setting it...

mellistibco avatar Nov 13 '19 22:11 mellistibco

@skothari-tibco as for your question about adding the s3 activity to the aws-contrib repo in the project-flogo org... Maybe @retgits would be kind enough to contribute his ;)

mellistibco avatar Nov 13 '19 22:11 mellistibco

@neethuabacker for the timer, were you using the new timer trigger? That is, this one: https://github.com/project-flogo/contrib/tree/master/trigger/timer

mellistibco avatar Nov 13 '19 22:11 mellistibco

@mellistibco yeah, I'd gladly contribute mine :) which repo should I create a PR for?

retgits avatar Nov 13 '19 22:11 retgits

@retgits 🎉 👏 https://github.com/project-flogo/aws-contrib

mellistibco avatar Nov 13 '19 22:11 mellistibco

Added https://github.com/project-flogo/aws-contrib/pull/7

retgits avatar Nov 13 '19 23:11 retgits

@neethuabacker for the timer, were you using the new timer trigger? That is, this one: https://github.com/project-flogo/contrib/tree/master/trigger/timer

no, I am using the timer that came with project flogo, did not install any other timer

neethuabacker avatar Nov 15 '19 20:11 neethuabacker