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

fix(athena-driver) #7407 allow to pass credentials #7429

Merged
merged 4 commits into from Nov 23, 2023
Merged

Conversation

trompa
Copy link
Contributor

@trompa trompa commented Nov 17, 2023

Check List

  • Tests has been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Issue Reference this PR resolves

[For example #12]

Description of Changes Made (if issue reference is not provided)

[Description goes here]

@trompa trompa requested a review from a team as a code owner November 17, 2023 11:30
@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label Nov 17, 2023
Copy link

vercel bot commented Nov 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-angular-dashboard ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2023 11:33am

@trompa
Copy link
Contributor Author

trompa commented Nov 22, 2023

I've actually found that this change wont work if I want to pass a provider. It compares to undefined and will override it.
will push a change where it checks typeof, so promises are also evaluated correctly

@trompa trompa changed the title #7407 allow to pass credentials fix(athena-driver) #7407 allow to pass credentials Nov 22, 2023
credentials: accessKeyId && secretAccessKey
? { accessKeyId, secretAccessKey }
: undefined,
credentials,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest simplifying this code by moving the original code for credentials:

credentials: accessKeyId && secretAccessKey
        ? { accessKeyId, secretAccessKey }
        : undefined,

before ...restConfig.

It will allow anyone to redeclare credentials by passing it via constructor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@ovr ovr merged commit f005c5b into cube-js:master Nov 23, 2023
21 of 23 checks passed
@ovr
Copy link
Member

ovr commented Nov 23, 2023

Thank you @trompa, for your contribution! 🍰

@M1ke
Copy link

M1ke commented Apr 2, 2024

This appears to cause a regression for services using instance metadata and not passing credentials in. We have a working cube install in production on v0.33 that when upgraded to v0.34 returns:

Resolved credential object is not valid

Rolling back to v0.33 resolved this. Checking the diff I can't see exactly why this might be the case, unless ...restConfig is exposing some requirement for credentials that's overwriting the credentials key in the object.

@ovr
Copy link
Member

ovr commented Apr 2, 2024

@M1ke

This appears to cause a regression for services using instance metadata and not passing credentials in.

It doesn't change that behavior. credentials is defined in both versions (before/after). This PR allows to override default credentials. Do you pass undefined as credentials?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:community Contribution from Cube.js community members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants