Hello Community, I have just spin up lightning instance,
I have a workflow using
kobotoolbox to version 2.4.3 in one of the steps (Fetching submissions)
I can’t figure why I am getting error on my run, I have tried switching to other versions but still fails
Will appreciate your help
R/T Starting step Fetch Cavac data from Kobotoolbox
R/T [linker] loading module @openfn/language-kobotoolbox
R/T [linker] Loading module @openfn/language-kobotoolbox from /tmp/openfn/worker/repo/node_modules/@openfn/language-kobotoolbox_2.4.3/dist/index.cjs
R/T Resolved adaptor @openfn/language-kobotoolbox to version 2.4.3
R/T Executing expression (1 operations)
R/T Starting operation 1
ADA The common.http.get function has been deprecated. This adaptor should migrate to use common.util.http instead.
R/T Fetch Cavac data from Kobotoolbox aborted with error (1.482s)
R/T Cleaning up state. Removing keys: configuration
R/T {
"details": {
"code": "ERR_BAD_REQUEST",
"config": {
"auth": {
"password": "mypasword",
"username": "myusername"
},
"env": {},
"headers": {
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br",
"User-Agent": "axios/1.1.3"
},
"maxBodyLength": -1,
"maxContentLength": -1,
"method": "get",
"timeout": 0,
"transformRequest": [
null
],
"transformResponse": [
null
],
"transitional": {
"clarifyTimeoutError": false,
"forcedJSONParsing": true,
"silentJSONParsing": true
},
@stephencoduor , I’ve shifted your post over to the Job Writing category. I’m sure someone with more Kobo experience will be able to help out soon!
@hunter or @mtuchi , have you guys used language-kobotoolbox@2.4.3
recently?
Thanks @taylordowns2000 , I have changed the base url to non eu server now its working.
Might be that its related to eu servers
jclark
January 11, 2025, 4:16pm
4
Hi @stephencoduor
Don’t worry about the deprecation warning bit. The part of the error you’ve highlighted is absolutely fine
The bit to focus on the error details:
"code": "ERR_BAD_REQUEST",
I’m not a kobo expert and that’s a generic error so it’s hard to be sure. It’s probably the EU servers. It’s possibly a credential issue too.
Fascinating! Was this a change to your kobo credential? Could you share the credential body, taking care not to scrub out any sensitive information like usernames and passwords?
I’d love to know exactly what fixed your issue.
@taylordowns2000 and @jclark Below is the error with the body
R/T Starting step Fetch Cavac data from Kobotoolbox
R/T [linker] loading module @openfn /language-kobotoolbox
R/T [linker] Loading module @openfn /language-kobotoolbox from /tmp/openfn/worker/repo/node_modules/@openfn /language-kobotoolbox_2.4.3/dist/index.cjs
R/T Resolved adaptor @openfn /language-kobotoolbox to version 2.4.3
RTE Payload limit: 10mb
VER Versions:
▸ node.js 18.17.1
▸ worker 1.8.6
▸ @openfn /language-kobotoolbox 2.4.3
R/T Executing expression (1 operations)
R/T Starting operation 1
ADA The common.http.get function has been deprecated. This adaptor should migrate to use common.util.http instead.
R/T Fetch Cavac data from Kobotoolbox aborted with error (2.642s)
R/T Cleaning up state. Removing keys: configuration
R/T {
“details”: {
“code”: “ERR_BAD_REQUEST”,
“config”: {
“auth”: {
“password”: “********”,
“username”: “my-username”
},
“env”: {},
“headers”: {
“Accept”: “application/json, text/plain, / ”,
“Accept-Encoding”: “gzip, deflate, br”,
“User-Agent”: “axios/1.1.3”
},
“maxBodyLength”: -1,
“maxContentLength”: -1,
“method”: “get”,
“timeout”: 0,
“transformRequest”: [
null
],
“transformResponse”: [
null
],
“transitional”: {
“clarifyTimeoutError”: false,
“forcedJSONParsing”: true,
“silentJSONParsing”: true
},
“url”: “https://eu.kobotoolbox.org/api/v2/assets/XXXXX/data/?format=json ”,
“xsrfCookieName”: “XSRF-TOKEN”,
“xsrfHeaderName”: “X-XSRF-TOKEN”
},
“message”: “Request failed with status code 401”,
“name”: “AxiosError”,
“status”: 401
},
“message”: “Request failed with status code 401”,
“name”: “AdaptorError”,
“severity”: “fail”,
“source”: “runtime”
}
R/T Check state.errors.345cd6d6-e1ba-4871-8506-b589297eerwqqd3fdc9 for details.
I am running lightning V 2.10.8
I have also realized that the google sheet adaptor is not loading when I am trying to create credentials. But I can see the Googlehealthcare See screenshot below
hey @stephencoduor I just tried testing the kobo issue with my demo form, and I am not able to replicate the error you’re encountering…
My code below works just fine where awAyD3p88iFseSorPKRa85
is my demo form/project Id.
getSubmissions({formId: 'awAyD3p88iFseSorPKRa85'}, state => {
console.log(state.data);
return state;
});
This cleaner version also works if you want to remove the logs
getSubmissions({formId: 'awAyD3p88iFseSorPKRa85'});
I also tried the following job code with the http
adaptor to make a regular HTTP api request and this also worked…
get('/api/v2/assets/awAyD3p88iFseSorPKRa85/data?format=json', {
headers: {'content-type': 'application/json'},
})
Therefore, I’d recommend double checking (1) your project id (e.g., awAyD3p88iFseSorPKRa85
) (2) your credential username/password, and (3) your user permissions to make sure you have read access to the form submissions data (and not just the form).
Finally, regarding the GoogleSheets Adaptor
not showing - I’m assuming you’re using your own deployment of OpenFn/lightning? If yes, GoogleSheets requires Oauth for authentication, so you will need to first configure an Oauth Client in your OpenFn instance before this adaptor’s credential form will be visible on the front-end. Also see the adaptor docs for GoogleSheet-specific Oauth configuration guidance.
If you’re using our cloud-hosted platform at app.openfn.org , we’ve already set up this GoogleSheets Oauth Client, so users there will find that credential already available.
Hoping that helps!