fix(region_config): fix configure endpoint bug in getRegionPrefix #129
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
generateRegionPrefix
that 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-1
will result incn-*
in the JS function andcn-north-*
in the Lua function.The PR fixes it and lets the
region_config_data
apply correctly.Issue
FTI-6159 mentioned an issue caused by this bug, which happens inside
cn-north-1
that 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