fix(region_config): fix configure endpoint bug in getRegionPrefix#129
Merged
Conversation
Luacheck Report2 tests 2 ✅ 0s ⏱️ Results for commit 93d3c6b. ♻️ This comment has been updated with latest results. |
catbro666
reviewed
Aug 15, 2024
tzssangglass
approved these changes
Aug 16, 2024
outsinre
approved these changes
Aug 16, 2024
catbro666
approved these changes
Aug 16, 2024
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug inside
generateRegionPrefixthat caused some service endpoint in specific region is not getting configured correctly.lua-resty-aws/src/resty/aws/init.lua
Lines 138 to 149 in 50d9f08
This code originates from the JS code here:
There is a bug in our Lua code, that
parts.slice(0, parts.length - 2).join('-') + '-*'is fetching the[0, #parts-2)items from the region parts and concatenating with another asterisk. But our SDK is just replacing the last item in the array with an asterisk, which equals fetching[0, #parts-2]and concatenating with another asterisk. (Here I'm using an index starting with 0 to clarify the difference). This caused different results when we generated region prefixes: a regioncn-north-1will result incn-*in the JS function andcn-north-*in the Lua function.The PR fixes it and lets the
region_config_dataapply correctly.Issue
FTI-6159 mentioned an issue caused by this bug, which happens inside
cn-north-1that is expected to apply thecn-*/*endpoint config. The bug caused a mismatch and endpoint config cannot be applied correctly. This bug would also influence other regions likeus-isob-east-1