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.

Cannot set context at app level after v1.9.0

See original GitHub issue

Cannot set context at app level anymore after v1.9.0. This is because a Tree child is automatically created under the app and context cannot be set after children have been added.

Comes from #4194 (3cca03d).

Reproduction Steps

const app = new cdk.App();
app.node.setContext('stage', 'dev');

Error Log

Error: Cannot set context after children have been added: Tree

Environment

  • CLI Version : > 1.9.0
  • Framework Version: > 1.9.0
  • OS : all
  • Language : all

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
eladbcommented, Oct 3, 2019

You can specify the context when you initialise the app:

new App({ context: { key: 'value' });

Closing for now.

2reactions
alex-a-ncinocommented, Dec 5, 2019

@eladb In the case of setting context when we initialize the app, how should the nested structures be handled? Context is expecting [key: string]: string which doesn’t allow setting a key to a nested object. Trying to set the context for js unit test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context | Android Developers
Return the set of parameters which this Context was created with, ... on what application context you can access; if the requested application...
Read more >
Runtime context - AWS Cloud Development Kit (AWS CDK) v2
Context values that are set by the AWS CDK Toolkit (the cdk command) can be set automatically, from a file, or from the...
Read more >
Docker Context - Docker Documentation
A Docker client that supports the top-level context command. Run docker context to verify that your Docker client supports contexts.
Read more >
Defining Tomcat context paths - Octopus Deploy
A nested context path like myapp/v1 means the web app can be accessed from a URL like http://localhost:8080/myapp/v1.
Read more >
Known issues — nRF Connect SDK 2.2.99 documentation
CIA-845: The application cannot be built with overlay-carrier.lib (carrier library) ... overlayv2.2.0v2.1.2v2.1.1v2.1.0v2.0.2v2.0.1v2.0.0v1.9.2v1.9.1v1.9.0.
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