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

Cannot construct Camunda8 using explicit configuration #153

Closed
jwulf opened this issue May 7, 2024 · 3 comments · Fixed by #155
Closed

Cannot construct Camunda8 using explicit configuration #153

jwulf opened this issue May 7, 2024 · 3 comments · Fixed by #155
Assignees

Comments

@jwulf
Copy link
Member

jwulf commented May 7, 2024

With no CAMUNDA_OAUTH_URL set in the env, constructing a Camunda8 object like this:

const camundaSdk = require('@camunda8/sdk');
const camunda = new camundaSdk.Camunda8({
  config: {
    ZEEBE_ADDRESS: 'zeebeAddress',
    ZEEBE_CLIENT_ID: 'camundaClientId',
    ZEEBE_CLIENT_SECRET: 'camundaClientSecret',
//    ZEEBE_AUTHORIZATION_SERVER_URL: 'https://login.cloud.camunda.io/oauth/token',
    CAMUNDA_OAUTH_URL: 'https://login.cloud.camunda.io/oauth/token'
  }
});

Throws:

Error: Missing required configuration CAMUNDA_OAUTH_URL. Please supply this value as an environment variable or configuration object field.
    at RequireConfiguration (/Users/jwulf/workspace/tmp/action-test/node_modules/@camunda8/sdk/dist/lib/RequireConfiguration.js:6:15)
    at new OAuthProvider (/Users/jwulf/workspace/tmp/action-test/node_modules/@camunda8/sdk/dist/oauth/lib/OAuthProvider.js:48:61)
    at new Camunda8 (/Users/jwulf/workspace/tmp/action-test/node_modules/@camunda8/sdk/dist/c8/index.js:36:34)
    at Object.<anonymous> (/Users/jwulf/workspace/tmp/action-test/index.js:2:17)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47
@jwulf jwulf self-assigned this May 7, 2024
@jwulf
Copy link
Member Author

jwulf commented May 7, 2024

Reproducer here: https://github.com/jwulf/repro-153

@jwulf
Copy link
Member Author

jwulf commented May 7, 2024

The OAuthProvider test should contain a test that scrubs the env and hydrates only through explicit config.

The smoke test needs to instantiate an OAuth component. It should also instantiate a Camunda8 object with explicit config and no env vars.

It also needs to scrub the process environment vars to test explicit configuration.

@pepopowitz
Copy link
Contributor

@jwulf and I paired and we think it's an issue with how the configuration object is being passed in.

When I construct the object like this, I get no errors:

const camunda = new Camunda8({
	ZEEBE_ADDRESS: 'zeebeAddress',
	ZEEBE_CLIENT_ID: 'camundaClientId',
	ZEEBE_CLIENT_SECRET: 'camundaClientSecret',
	CAMUNDA_OAUTH_URL: 'https://login.cloud.camunda.io/oauth/token',
})

The README.md suggests passing the configuration as a config property, but in fact the constructor actually wants the configuration as the only argument.

jwulf added a commit that referenced this issue May 7, 2024
Give a correct example constructor of Camunda8 in the README

fixes #153
jwulf added a commit that referenced this issue May 7, 2024
Give a correct example constructor of Camunda8 in the README

fixes #153
@jwulf jwulf closed this as completed in #155 May 7, 2024
jwulf added a commit that referenced this issue May 7, 2024
Give a correct example constructor of Camunda8 in the README

fixes #153
github-actions bot pushed a commit that referenced this issue May 8, 2024
## [8.5.3](v8.5.2...v8.5.3) (2024-05-08)

### Bug Fixes

* **repo:** fix example in README ([#154](#154)) ([#155](#155)) ([4fb36d7](4fb36d7)), closes [#153](#153)
github-actions bot pushed a commit that referenced this issue May 8, 2024
## [8.5.3](v8.5.2...v8.5.3) (2024-05-08)

### Bug Fixes

* **repo:** fix example in README ([#154](#154)) ([#155](#155)) ([4fb36d7](4fb36d7)), closes [#153](#153)
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

Successfully merging a pull request may close this issue.

2 participants