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(server): Fix case of duplicate connectionId with different providers for /connections/:id #3198

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

nalanj
Copy link
Contributor

@nalanj nalanj commented Dec 18, 2024

Reverts the previous revert and adds test for that test case.

@nalanj nalanj requested a review from a team December 18, 2024 20:35
@nalanj nalanj marked this pull request as ready for review December 18, 2024 20:35
connectionConfig?: any;
}
): Promise<NangoConnection> => {
const name = rest?.connectionId ? rest.connectionId : Math.random().toString(36).substring(7);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🍖 make connectionId configurable through rest

Copy link
Collaborator

Choose a reason for hiding this comment

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

not a huge fan of this pattern. I am ok going with it because this change is time sensitive as long as we follow up immediately with a PR to use a object as parameter

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its not a pattern its just like that for historical reason, changing to object will update a lot of tests so it was easier like this (we cant fix everything all the time unfortunately)
Happy to see it changed to object 👌🏻

});
});

it('should get a connection despite another connection with same name on a different provider', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🍖 Add test with multiple providers. I can remove the prior test if we want but it was helpful to have a case I could run with the regression and the fix not applied yet.


// We get connection one last time to get endUser, errors
// This is very unoptimized unfortunately
const finalConnections = await connectionService.listConnections({ environmentId: environment.id, connectionId, integrationIds: [providerConfigKey] });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🍖 THE FIX

@nalanj nalanj self-assigned this Dec 18, 2024
connectionConfig?: any;
}
): Promise<NangoConnection> => {
const name = rest?.connectionId ? rest.connectionId : Math.random().toString(36).substring(7);
Copy link
Collaborator

Choose a reason for hiding this comment

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

not a huge fan of this pattern. I am ok going with it because this change is time sensitive as long as we follow up immediately with a PR to use a object as parameter

@nalanj nalanj merged commit 95a9745 into master Dec 18, 2024
22 checks passed
@nalanj nalanj deleted the alan/get-connection-fix branch December 18, 2024 20:44
nalanj added a commit that referenced this pull request Dec 18, 2024
…t providers for /connections/:id (#3198)"

This reverts commit 95a9745.
nalanj added a commit that referenced this pull request Dec 18, 2024
…nt providers for /connections/:id (#3198)"

This reverts commit 01058b9.
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 this pull request may close these issues.

3 participants