Connector per Mongo sviluppato con Go

Ho una bozza di un connettore per Mongo sviluppato con Go. Funziona e apparentemente produce il re di Json che è previsto. Chiaramente ha bisogno di un pacchetto specifico per connettersi a Mongo (in questo caso “” più alcune altre cose attorno ad esso) e qui arriva il problema. il tutto “funziona sulla mia macchina” ma non quando viene distribuito. Ho provato a seguire le istruzioni descritte qui ma senza successo.
Ora la domanda è: posso pubblicare un PR con il codice che non funziona dopo la distribuzione e chiedere aiuto a qualcuno? devo fare qualcosa di diverso? Grazie

(testo tradotto con Google Translator)

1 Mi Piace

You can write in english, no problem for this. I can help with your connector (I wrote the Go runtime :slight_smile: ) please share your connector code in your repo and I will give a look and try to help with it.

Domanda Stupida, hai messo in white-list su Mongo l’ip della macchina di sviluppo che usi e altri IP dopo la distribuzione ?

Si. Uso Mongo Atlas e li ho messo “Ip Access list” con “”.
Non credo quello sia il problema.
Grazie in ogni caso

I have 3 branches in my repo which somehow describe the history of my experience so far.

What works on my machine and on iosdk
First thing I have implemented is the logic to return the “form fields”. This is a pretty simple thing, reading some json configuration and returning a map[string]interface{} as per my understanding of open-whisk with Go.
This is developed with Go1.15.
I deploy this code to iosdk with a script ( and everything works, i.e. the form fields are correctly shown in iosdk when selecting the “custom import” button.
Here the link to the folder containing the Go code:

Full logic of the connector working with Go1.15 (on my machine)
Then I moved on and created the actual logic to connect to Mongo, fetch data, prepare the messages and return them.
This thing works on my machine, but now I have the mongo driver as an external dependency. So, according my understanding of the open-whisk documentation (, I can not deploy the code in the Go1.15 format (using modules) and rather I have to use the dep tool.
The working (on my machine) code with the full logic in Go1.15 can be found here

What does not work in iosdk with Go1.11 and dependencies managed via dep tool
Finally I tried to follow the instructions in the open-whisk documentation, at least according to my understanding of how the dep tool works (never used before). I have launched the dep tool, which by the way brings me back to Go1.11.
Gopck.toml is created, vendor folder as well.
But now, if I deploy this code with the same script nothing works. I see on the console of the browser the following error message when the import request is issued

  "code": "WybUMA1mdV3zLrgOiukHixpa1xrwzase",
  "error": "There was an error processing your request."

Since the error is received while trying to load the form, I suspect that the connection to Mongo itself is not the cause of the problem, which probably lays in something wrong I have made while organizing the code structure or deploying it.
Here the code at this stage of its evolution:

I hope this long mail is clear enough to illustrate the issue. Do not hesitate to reach out if something is not clear.

Ciao and have a good week end

The go 1.15 runtime now uses go modules, as it is documented in the examples in the go runtime repository. Check here

Basically, it works in the runtime as long as you can do go build in a directory including a go.mod for dependencies. Usually I test go actions using go tests. Check the examples they should help.

There are no differences from “openwhisk” and iosdk as it is basically a packaged standalone openwhisk with bundled Redis and a web server for the frontend.

I see no errors. I strongly think it is a configuration limitation of the environment in which you deploy

I think the problem is that he is referring to official documentation that is not updated, as I updated the go runtime to support go modules (although the vendor folder should still work)…

Thanks for your answers.
Unfortunately I have not been able to solve the problem yet.
I think there must be an issue on how I deploy a Go1.15 application which used Modules and has an external dependency (the Go Mongo driver in this case).
This is what I currently do when I want to deploy

  1. First I create a zip ( with all the sources contained in the src folder
  2. Then I launch this command wsk action update iosdk/import --main Main --docker openwhisk/action-golang-v1.15:nightly from the terminal presented by the IDE provided by iosdk on the browser (http://localhost:3000/#/home/project)
    No error is received

Unfortunately when I try to load the “Custom import” I get an error on the browser console, with a Json response like this

  "code": "qXLl0Hgmn7h4XbWOcuARsMSG0SkIXpAX",
  "error": "There was an error processing your request."

I do not know where to look to understand better what went wrong.
Any suggestion from your side?
Could you try to download my code from here ( and see if you are able to see the forms fields?
Thanks in advance

The problem is in the structure of the zip file. You should not place the source in the src folder but in the top level. Also the go.mod should be in the top-level. The src structure is the one to use when you had to use the (now deprecated) dep tool.