Unable to get configuration from AppConfig on browser
See original GitHub issueDescribe the bug
@aws-sdk/client-appconfig
is referencing tslib@2.0.0
and that package does not implement __spreadArray
. When loading the package on a React app I see the following warnings
"export '__spreadArray' was not found in 'tslib'
I am not able to fetch the App Configs
Your environment
SDK version number
@aws-sdk/client-appconfig@3.21.0
Is the issue in the browser/Node.js/ReactNative?
Browser
Details of the browser/Node.js/ReactNative version
Chrome: 91.0.4472.164
node -v
v10.22.0
Steps to reproduce
export const getAppConfigs = async (
code: String,
): Object => {
try {
const Client = new AppConfigClient({
region: <REGION>,
credentials: {
accessKeyId: <ACCESS_KEY>,
secretAccessKey: <SECRET_KEY>
}
});
const command = new GetConfigurationCommand({
Application: `App-${code}`,
ClientId: `App-${code}-Client`,
Configuration: "AppConfig",
Environment: "Dev"
});
const response = await Client.send(command); // Fails here
let parsedConfigs = JSON.parse(
String.fromCharCode.apply(null, response.Content)
);
} catch (error) {
throw error;
}
};
Observed behavior
When I send a request I get the following error
TypeError: Object(...) is not a function
at MiddlewareStack.js:110
at Array.reduce (<anonymous>)
at getMiddlewareList (MiddlewareStack.js:108)
at Object.resolve (MiddlewareStack.js:190)
at GetConfigurationCommand../node_modules/@aws-sdk/client-appconfig/dist/es/commands/GetConfigurationCommand.js.GetConfigurationCommand.resolveMiddleware (GetConfigurationCommand.js:64)
at AppConfigClient../node_modules/@aws-sdk/client-appconfig/node_modules/@aws-sdk/smithy-client/dist/es/client.js.Client.send (client.js:10)
at _callee3$ (Auth.js:122)
Expected behavior
Expected to receive the AppConfig blob response.
Screenshots
According to browser dev tools the MiddlewareStack.js:110
depends on __spreadArray
Additional context
I replaced tslib
from @aws-sdk/client-appconfig@3.21.0
manually with version tslib@2.3.0
and the following warning went away.
"export '__spreadArray' was not found in 'tslib'
However, the request kept on failing when trying to fetch the AppConfigs
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Step 6: Retrieving the configuration - AWS AppConfig
Your application retrieves configuration data by first establishing a configuration session using the StartConfigurationSession API action.
Read more >c# - Reading settings from app.config or web.config in .NET
config file (depending on whether the DLL is referenced from an ASP.NET web application or a Windows Forms application). I've found that ConfigurationSettings....
Read more >How to: Read application settings - .NET Framework
This article shows you how to add a simple setting to an App.config file in a .NET Framework app, and then read the...
Read more >GetConfiguration - Amazon AppConfig - 亚马逊云科技
The input fails to satisfy the constraints specified by an Amazon service. HTTP Status Code: 400. InternalServerException. There was an internal failure in...
Read more >Manage And Read Configurations using ... - Tools QA
This is a little different from what we have learned above. appSettings attribute is used to store the data in the Key/Value pair....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
__spreadArray
is only available after tslib 2.1.0, however, most of the SDK package targets tslib^2.0.0
. I will put up a fix to bump up the tslib version. We should have bump up the tslib everytime we upgrade our TypeScript version. Luckily TypeScript team posted the compatibility table recently: https://github.com/microsoft/tslib/issues/148This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.