question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get configuration from AppConfig on browser

See original GitHub issue

Describe 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 image

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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AllanZhengYPcommented, Jul 19, 2021

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/148

0reactions
github-actions[bot]commented, Aug 5, 2021

This 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found