project-flogo / cli

CLI used to create & build Flogo applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build command error - cannot use engine.DirectRunner

akpuvvada opened this issue · comments

I am trying to follow steps in https://tibcosoftware.github.io/flogo/faas/how-to/ to try Flogo.
When I try to run Flogo Build command, I am getting below error. Please help me understand how to resolve this. I am using the same JSON as given in the page.

C:\Flogo\Lambda\myapp>flogo build -e --shim start_flow_as_a_function_in_lambda
Error in building C:\Users\206503518\OneDrive - NBCUniversal\My Documents\Desktop\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2
.\shim_support.go:25:21: cannot use engine.DirectRunner (type func(*engine.engineImpl)) as type engine.Option in argument to engine.New

After this gets merged you can do flogo update github.com/project-flogo/core@master . And one more thing. it should be flogo build -e --shim aws_lambda_trigger("id" of the trigger) . It should be changed in the doc too.

After this gets merged you can do flogo update github.com/project-flogo/core@master . And one more thing. it should be flogo build -e --shim aws_lambda_trigger("id" of the trigger) . It should be changed in the doc too.

Thanks, Samip.

When is this expected to merge or is it already merged? How do I know?

It's merged.

Still not working. Now I am getting new error.

flogo build -e --shim aws_lambda_trigger
This trigger makes use of a go build file...
Error in building C:\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2
.\shim_support.go:14:2: cfgEngine redeclared in this block
        previous declaration at .\main.go:18:2


Did you run flogo update github.com/project-flogo/core@master ?

Did you run flogo update github.com/project-flogo/core@master ?

Yes, I did and it was successful.

C:\Flogo\Lambda_First>flogo update github.com/project-flogo/core@master
Error validating project: not a valid flogo app project directory, missing 'src' diretory

C:\Flogo\Lambda_First>cd myapp

C:\Flogo\Lambda_First\myapp>flogo update github.com/project-flogo/core@master

C:\Flogo\Lambda_First\myapp>

Hmm. I am not facing that issue. Can you try recreating the project and updating the core again?

I deleted the myapp folder and tried again. Below is the complete log

Microsoft Windows [Version 10.0.16299.1451]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\206503518>cd C:\Flogo\Lambda_First

C:\Flogo\Lambda_First>set http_proxy=http://proxy.test.com:80/

C:\Flogo\Lambda_First>flogo create -f flogo.json myapp
Creating Flogo App: myapp
Installing: github.com/project-flogo/core@latest
Installed action: github.com/project-flogo/flow
Installed trigger: github.com/project-flogo/aws-contrib/trigger/lambda
Installed activity: github.com/project-flogo/contrib/activity/actreturn
Installed activity: github.com/project-flogo/contrib/activity/log
Installed function: github.com/project-flogo/contrib/function/string

C:\Flogo\Lambda_First>cd myapp

C:\Flogo\Lambda_First\myapp>flogo build -e --shim aws_lambda_trigger
This trigger makes use of a go build file...
Error in building C:\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2
.\shim_support.go:25:21: cannot use engine.DirectRunner (type func(*engine.engineImpl)) as type engine.Option in argument to engine.New


C:\Flogo\Lambda_First\myapp>

You didn't do flogo update github.com/project-flogo/core@master . But something's going on here that I don't understand. You shouldn't be getting

.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
...

I tried the same thing and it worked for me. I would suggest try installing flogo-cli again. If it doesn't work, Can you zip up myApp folder and share it ?

I reinstalled the CLI and tried again.
Still getting error. Please help. Below please find complete command history with console output/errors.
Let me know if you need any more details.

Microsoft Windows [Version 10.0.16299.1451]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\206503518>echo %GOPATH%
C:\Users\206503518\go

C:\Users\206503518>go get -u github.com/project-flogo/cli/...

C:\Users\206503518>
C:\Users\206503518>go get -u github.com/project-flogo/cli/...

C:\Users\206503518>
C:\Users\206503518>cd C:\Flogo\Lambda_First

C:\Flogo\Lambda_First>cd myapp

C:\Flogo\Lambda_First\myapp>flogo build -e --shim aws_lambda_trigger
Error in installing 'github.com/project-flogo/aws-contrib/trigger/lambda'
Error synchronzing imports: go: github.com/aws/aws-lambda-go@v1.10.0: Get https://proxy.golang.org/github.com/aws/aws-lambda-go/@v/v1.10.0.mod: dial tcp: lookup proxy.golang.org: no such host


C:\Flogo\Lambda_First\myapp>set http_proxy=http://proxy.test.com:80/

C:\Flogo\Lambda_First\myapp>flogo build -e --shim aws_lambda_trigger
This trigger makes use of a go build file...
Error in building C:\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2
.\shim_support.go:25:21: cannot use engine.DirectRunner (type func(*engine.engineImpl)) as type engine.Option in argument to engine.New


C:\Flogo\Lambda_First\myapp>cd ..

C:\Flogo\Lambda_First>flogo create -f flogo.json myapp
Creating Flogo App: myapp
Installing: github.com/project-flogo/core@latest
Installed action: github.com/project-flogo/flow
Installed trigger: github.com/project-flogo/aws-contrib/trigger/lambda
Installed activity: github.com/project-flogo/contrib/activity/actreturn
Installed activity: github.com/project-flogo/contrib/activity/log
Installed function: github.com/project-flogo/contrib/function/string

C:\Flogo\Lambda_First>flogo update github.com/project-flogo/core@master
Error validating project: not a valid flogo app project directory, missing 'src' diretory

C:\Flogo\Lambda_First>flogo create -f flogo.json myapp
Creating Flogo App: myapp
Installing: github.com/project-flogo/core@latest
Installed action: github.com/project-flogo/flow
Installed trigger: github.com/project-flogo/aws-contrib/trigger/lambda
Installed activity: github.com/project-flogo/contrib/activity/actreturn
Installed activity: github.com/project-flogo/contrib/activity/log
Installed function: github.com/project-flogo/contrib/function/string

C:\Flogo\Lambda_First>cd myapp

C:\Flogo\Lambda_First\myapp>flogo update github.com/project-flogo/core@master

C:\Flogo\Lambda_First\myapp>flogo build -e --shim aws_lambda_trigger
This trigger makes use of a go build file...
Error in building C:\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2
.\shim_support.go:14:2: cfgEngine redeclared in this block
        previous declaration at .\main.go:18:2


C:\Flogo\Lambda_First\myapp>

Alright. So this issue does show up in windows. Let me work on it and I'll keep you posted.

Alright. So this issue does show up in windows. Let me work on it and I'll keep you posted.

Thanks

Hi Samip, Is this going to take time?

I have updated the cli with the patch. The thing is you should have the zip which you can upload to AWS in the src . It's only giving error because of other reasons. The complete solution will be added in couple of days after review.

Thanks for the update. Let me know when ready. I found the zip file created.

That zip file is empty. There is no files in it. I was not able to test it as I don't have permission to deploy in AWS - checking with support.
Is that expected that the zip file is empty?

You mean the zip file is of 0 mb size?

Size says 1 KB and when I open it in 7zip, I don't see any files in it.
Also, when I unzip the file, I get an empty folder.

Well the zip is the compressed version of the binary. It is not suppose to contain any files. I would suggest updating the cli and running the build again. The binary name handler should be created and must be of atleast 10 mb .

I have seen sample handler.zip files worked on by my colleagues in older version of Flogo which have files. I am still following-up on permission to create lambda function in AWS. Yet to test uploading/deploying.

Hi @skothari-tibco any update on this issue?

Yes. The CLI has been updated. So if you would update the CLI and the core version, the demo will work on the Lambda. But let me know if you have any issues.

Hi Samip,
I have tested now again and I am still seeing error in flogo build. Below is the complete log:

C:\Users\206503518>cd C:\Flogo\Lambda_First

C:\Flogo\Lambda_First>set http_proxy=http://proxy.inbcu.com:80/

C:\Flogo\Lambda_First>flogo create -f flogo.json myapp
Creating Flogo App: myapp
Installing: github.com/project-flogo/core@latest
Installed action: github.com/project-flogo/flow
Installed trigger: github.com/project-flogo/aws-contrib/trigger/lambda
Installed activity: github.com/project-flogo/contrib/activity/actreturn
Installed activity: github.com/project-flogo/contrib/activity/log
Installed function: github.com/project-flogo/contrib/function/string

C:\Flogo\Lambda_First>cd myapp

C:\Flogo\Lambda_First\myapp>flogo update github.com/project-flogo/core@master

C:\Flogo\Lambda_First\myapp>flogo build -e --shim aws_lambda_trigger
This trigger makes use of a go build file...
Error in building C:\Flogo\Lambda_First\myapp\src
Error building project: # main
.\shim.go:30:6: main redeclared in this block
        previous declaration at .\main.go:22:6
.\shim_support.go:12:2: cfgJson redeclared in this block
        previous declaration at .\main.go:17:2
.\shim_support.go:13:2: cfgEngine redeclared in this block
        previous declaration at .\main.go:18:2
.\shim_support.go:14:2: cfgCompressed redeclared in this block
        previous declaration at .\main.go:19:2


C:\Flogo\Lambda_First\myapp>

What's the flogo cli version ?

flogo cli version 0.9.1-rc.2-2-g67f15b4

Yeah... that needs to be updated.

I reinstalled the CLI this morning. Thought that will fetch latest version. How do I update it?

Can you try it again? It should say 0.9.1-rc.3 .

I'm guessing this worked right?

Yes, Samip. Thanks.