Skip to main content

Hello, 

 

We are using: Toolkit Version '0.5.20' 

We are having a file schedules.Function.yaml: 

- name: Run every 10 minutes to do some work
functionExternalId: fn_name
description: Run every 10 minutes to do some work
cronExpression: "*/10 * * * *"
data:
extractionPipeline: "test"

When deploying we have this error trace:
 

Traceback (most recent call last):
File "venv/bin/cdf-tk", line 8, in <module>
sys.exit(app())
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf.py", line 116, in app
_app()
File "venv/lib/python3.10/site-packages/typer/main.py", line 340, in __call__
raise e
File "venv/lib/python3.10/site-packages/typer/main.py", line 323, in __call__
return get_command(self)(*args, **kwargs)
File "venv/lib/python3.10/site-packages/click/core.py", line 1161, in __call__
return self.main(*args, **kwargs)
File "venv/lib/python3.10/site-packages/typer/core.py", line 740, in main
return _main(
File "venv/lib/python3.10/site-packages/typer/core.py", line 195, in _main
rv = self.invoke(ctx)
File "venv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "venv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "venv/lib/python3.10/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
File "venv/lib/python3.10/site-packages/typer/main.py", line 698, in wrapper
return callback(**use_params)
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/apps/_core_app.py", line 280, in deploy
cmd.run(
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/commands/_base.py", line 55, in run
raise e
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/commands/_base.py", line 52, in run
result = execute(*args, **kwargs)
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/apps/_core_app.py", line 281, in <lambda>
lambda: cmd.execute(
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/commands/deploy.py", line 165, in execute
result = self.deploy_resources(
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/commands/deploy.py", line 197, in deploy_resources
return self._deploy_resources(
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/commands/deploy.py", line 224, in _deploy_resources
to_create, to_update, to_delete, unchanged, duplicated = worker.load_resources(
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/loaders/_worker.py", line 109, in load_resources
resource_list = self.loader.load_resource_file(filepath, environment_variables)
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/function_loaders.py", line 128, in load_resource_file
item_id = self.get_id(item)
File "venv/lib/python3.10/site-packages/cognite_toolkit/_cdf_tk/loaders/_resource_loaders/function_loaders.py", line 102, in get_id
return itemr"externalId"]
KeyError: 'externalId'

Could you please check?

@Anders Albert will you be able to help out here?


You are showing the configuration for a FunctionSchedule, while the error is caused by missing exeternalId in a Function. I expect there is a missing externalId in a function configuration. You should have gotten a warning about this when you ran the cdf build command.

Note that we are in the process of improving these types of errors, if you upgrade past 0.5.35 you will get an improved feedback on errors in the Function configuration in the cdf build command.


Hello ​@Anders Albert ,

I finally found the issue. The file should have been called schedules.Schedule.yaml.

The documentation for yaml reference for cdf toolkit is super out to date unfortunatly. Could you please update it based on the new references? 

https://docs.cognite.com/cdf/deploy/cdf_toolkit/references/resource_library/

Thank you so much


@Marwen TALEB Thanks for that deep debugging, we really appreciate the effort. I hope the documentation is not generally out-of-date, but I see we have an error in the Function Schedule. I will fix immediately, and go through all the resources to ensure they are all up-to-date there is no-more misleading information. 


FYI: Docs are updated: https://docs.cognite.com/cdf/deploy/cdf_toolkit/references/resource_library/#function-schedules
 


Reply