Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting a project only works with ui #24

Closed
GordianDziwis opened this issue Nov 22, 2021 · 4 comments
Closed

Starting a project only works with ui #24

GordianDziwis opened this issue Nov 22, 2021 · 4 comments

Comments

@GordianDziwis
Copy link

kimai2-cmd start "Foo" "Bar" -v -i

Results in

Found in KIMAI_CONFIG envvar: /home/beavis/.config/kimai2/settings.ini
settings.ini found at: /home/beavis/.config/kimai2/settings.ini
---
calling kimai:  GET projects [object Object]
request options: [object Object]
Response body: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
---
calling kimai:  GET activities [object Object]
request options: [object Object]
Response body: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
---
calling kimai:  GET config/i18n [object Object]
request options: [object Object]
kimaistart calling api: [object Object]
---
calling kimai:  POST timesheets [object Object]
request options: [object Object]
Response body: [object Object]
Server error message:
400
Validation Failed
(node:488024) UnhandledPromiseRejectionWarning: Validation Failed
(Use `node --trace-warnings ...` to show where the warning was created)
(node:488024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:488024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Response body: [object Object]
servertime: 2021-11-22T15:36:47+0100
localtime: 2021-11-22T15:36:47+01:00
@infeeeee
Copy link
Owner

infeeeee commented Nov 22, 2021

I can't reproduce this. Error 400 means, something is malformed in the request to kimai.

How did you installed kimai2-cmd?

If you installed it with npm you can change t manually. In this line:

debug("request options: " + options)

add .body behind options, so it should look like this:

debug("request options: " + options.body)

If you installed a prebuilt, I just created a new build with this extra debugging: https://github.com/infeeeee/kimai2-cmd/releases/tag/1.3.1

Post the output of the same command with this new version

@GordianDziwis
Copy link
Author

This helped, the issue is that all my activities have the same name Work. Kimai2-cmd queries by name for the activity id and if there exists multiple activities with the same name, it just uses the first one. Which could belong to another project.

@infeeeee
Copy link
Owner

You can use global activities instead: https://www.kimai.org/documentation/activity.html#global-activities
They are working perfectly in kimai2-cmd.

I don't know how I could solve this client side.

@GordianDziwis
Copy link
Author

This helps, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants