Weather Service API call

Anyone made an API call to a (free) weather service yet? I have been trying loads of services, NPM packages and different type of code, however I keep getting errors and results not useable in a flow.

I have used ChatGPT to generate me some code which actually works, however I keep on getting this error:

TypeError: codePieceModule. code is not a function
at Object. <anonymous>
(webpack: //activepieces/engine/src/lib/executors/code-
executer. ts: 9:32)
at (<anonymous>)
at fulfilled
(webpack: //activepieces/node modules/tslib/tslib.es6.mjs: 118:41)

This is a very open request, anyone got some tips and maybe a small tutorial on how to set this up.
Much appreciated!

I figured it our by using a simple https:// get request and this demo:

For anyone who might be interested :wink:

Hi Samuel,

The reason behind this issue is that the code expected everything to be implemented inside a function called “code.”

I assume you used ChatGPT to generate code, but it didn’t include the code inside this function. I think adding code generation feature by OpenAI would prevent this issue for other users.

A while ago, we included a warning, but I believe it can be improved. Open to suggestions.

Another user friendly way is to use HTTP piece from core pieces, as you suggested :smiley:

1 Like

@Samuel Glad to see it working for you. I hope you’re enjoying Activepieces!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.