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.

Automatic token exports can not be arrays

See original GitHub issue

Reproduction Steps

Add the following to your stack:

Fn.select(0, vpcEndpoint.vpcEndpointDnsEntries)

It generates the following which is incorrect since DnsEntries are a string

"ExportsOutputFnGetAttVPCVpcCloudAuthVpcEndpointA6A0016BDnsEntries65E2739D": {
  "Value": {
    "Fn::GetAtt": [
      "VPCVpcCloudAuthVpcEndpointA6A0016B",
      "DnsEntries"
    ]
  },
  "Export": {
    "Name": "Vpc:ExportsOutputFnGetAttVPCVpcCloudAuthVpcEndpointA6A0016BDnsEntries65E2739D"
  }
}

Error Log

Vpc: creating CloudFormation changeset...

 ❌  Vpc failed: Error [ValidationError]: Template format error: The Value field of every Outputs member must evaluate to a String.
    at Request.extractError (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/home/linuxbrew/.linuxbrew/Cellar/aws-cdk/1.20.0/libexec/lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  message: 'Template format error: The Value field of every Outputs member must evaluate to a String.',
  code: 'ValidationError',
  time: 2020-01-19T23:30:22.007Z,
  requestId: '43c10843-42a8-4439-a770-a77ec7859f46',
  statusCode: 400,
  retryable: false,
  retryDelay: 109.59137506513541
}
Template format error: The Value field of every Outputs member must evaluate to a String.

Environment

  • CLI Version :
  • Framework Version:
  • OS :
  • Language :

Other


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
timpurcommented, May 20, 2020

I have experience the same issue had had to create my own way around it (not ideal 😛)

@SomayaB and @rix0rrr you asked about example code, here it is (https://github.com/timpur/aws-cdk-issue-5897/blob/master/cdk.out/Stack1.template.json#L18).

Very basic stack but produces the issue. Seems the select happens in the consumer which is fine bout the generated output doesnt account for refs that are arrays of strings …

I imagine is something to do with this line (https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/core/lib/private/refs.ts#L183)

Thanks. Hopes this helps

1reaction
arkoncommented, Jul 1, 2022

Would be ideal if the manual workaround wasn’t needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Runtime context - AWS Cloud Development Kit (AWS CDK) v2
Context values are scoped to the construct that created them; they are visible to child constructs, but not to parents or siblings. Context...
Read more >
Vue 3 passing array warning: Extraneous non-props attributes ...
Vue 3 passing array warning: Extraneous non-props attributes were passed to component but could not be automatically inherited ; export default ; props...
Read more >
Solve common issues with JSON in SQL Server
Although there is no difference in the JSON output, AUTO mode ... I want to produce complex JSON with several arrays on the...
Read more >
Project import/export API - GitLab Docs
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/export". Status can be one of: none : No exports queued, ...
Read more >
Authorize send requests | Firebase Cloud Messaging - Google
To mint this token, you can use Google Application Default Credentials (in ... For the fullest automation of the authorization flow, use ADC...
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