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

[Core-client] BUG: getRequestUrl method adds the path twice #21595

Closed

Conversation

JonathanCrd
Copy link
Member

@JonathanCrd JonathanCrd commented Apr 26, 2022

Packages impacted by this PR

  • Core-client

Issues associated with this PR

None

Describe the problem that is addressed by this PR

After migrating Keyvault Secrets to Core V2 (Issue #15896, PR is not out yet), two tests were no longer passing:

  • Secret client - list secrets in various ways
    • can list deleted secrets
    • can list deleted secrets by page

In a debug session with @sadasant, by looking at the logs and the URLs of the requests, we discovered that an extra "/deletedSecrets" path in the request URL, so the server was throwing us an error. We dug in the KeyVault code to see where the URL was being modify and we found out that Core was the one modifying the URL.

For reference, the test did 2 consecutive requests, the first one looked like:

https://mykeyvault.vault.azure.net/deletedsecrets?api-version...

and the second one looked like:

https://mykeyvault.vault.azure.net/deletedsecrets/deletedsecrets?api-version...

I have made a change in this PR which solves this issue for the two tests, and also added a test case for it.

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

This solution check if the path is already part of the URL and prevent adding it in a else block.

I'm open to discuss other ideas on how to fix this, or if someone else knows a better approach for this bug.

Are there test cases added in this PR? (If not, why?)

Yes, a test case was added for getRequestUrl, providing an URL with the specified path option already in it.

Checklists

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

CC: @sadasant @sarangan12

@azure-sdk
Copy link
Collaborator

API change check for @azure/core-client

API changes are not detected in this pull request for @azure/core-client

@JonathanCrd
Copy link
Member Author

This PR is no longer needed, after having a discussion with @xirzec and the rest of the team we concluded that Core shouldn't handle of these particular scenarios.

Regarding the error faced in the KeyVault package, that is fixed by using one of the generated methods with the keyword "Next" in them. The error was caused because the pagination logic is on the custom layer, and it's not being generated, so the methods that passes a continuation token should be modified manually (this was very opaque when debugging).

So, for the record, next time facing an issue similar to this, make sure to modify the method in which the continuation token is being passed, something like this: getDeletedSecret -> getDeletedSecretNext

azure-sdk pushed a commit to azure-sdk/azure-sdk-for-js that referenced this pull request Feb 14, 2023
Release apimangement 2022-08 01 (Azure#22313)

* Release api management 2022 08 01 (Azure#21169)

* add base for 2022-08-01

* updates readme.md

* update api-version and examples

* resolve Go SDK breaking change

* update examples to fix model definition

Co-authored-by: Chenjie Shi <tadelesh.shi@live.cn>

* Adding Resolver Entities to documentation (Azure#21352)

* merging in resolver entities

* adding resolver updates

* fixed policy examples that were missing a policyId param

* fixed typo that added a nested properties prop

* fixed description for API Resolvers List, filter query

* fixed error in definitions for resolvers

* fixed example that had an incorrect response definition

* added missing json file references

* fix for linting errors

* ref fixes and undoing bad merge overwrites

* fix typo

* wiki for apis and products  (Azure#21595)

* wiki for apis and products

* prettier; fixed spellchecks

* Fixed spelling

* Updated path

Co-authored-by: changlong-liu <59815250+changlong-liu@users.noreply.github.com>

* code review changes; gihub checks fixes

* fixed conact name and paths

* added properties back

* added contract properties objects

* fixed lint

* changed example to match the definition

* prettier

* code review changes

* added paths and examples for wiki collections

* Added x-ms-pageable

* removed count

Co-authored-by: changlong-liu <59815250+changlong-liu@users.noreply.github.com>

* Add ConfirmConsentCode to APIM RP (Azure#22418)

* Update apimauthorizationproviders.json

Add ConfirmConsentCode endpoint

* Update definitions.json

* Create ApiManagementPostAuthorizationConfirmConsentCodeRequest.json

* Update definitions.json

Remove count property

* Update apimauthorizationproviders.json

* [2022-08-01] Fix Linter Errors (Azure#22537)

* linter errors

* prettier

* v2

* fix error response duplicate schema

* type object

* prettier

* sync data from current ga version

* remove duplicate parameter

* type object

---------

Co-authored-by: Chenjie Shi <tadelesh.shi@live.cn>
Co-authored-by: hoonality <92482069+hoonality@users.noreply.github.com>
Co-authored-by: malincrist <92857141+malincrist@users.noreply.github.com>
Co-authored-by: changlong-liu <59815250+changlong-liu@users.noreply.github.com>
Co-authored-by: Logan Zipkes <44794089+LFZ96@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants