hey team -- i'm having issues accessing `context.o...
# dagster-feedback
s
hey team -- i'm having issues accessing
context.op_config
within an asset context -- the dictionary comes back as None, even when a default has been set. For example, taking this from the docs and adding a default value:
Copy code
import json
from dagster import asset, Field

@asset(config_schema={"person_name": Field(str, default_value="stephen")})
def asset_using_config(context):
    # Note how asset config is also accessed with context.op_config
    <http://context.log.info|context.log.info>(f'hello {context.op_config["person_name"]}')
    return True
returns an error when I click "materialize" in the UI, because the object is empty. (logs in thread). Am I missing something, or is this a bug?
plus1 1
logs
Copy code
dagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "asset_using_config"::

TypeError: 'NoneType' object is not subscriptable

Stack Trace:
  File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_core/execution/plan/utils.py", line 47, in solid_execution_error_boundary
    yield
  File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_utils/__init__.py", line 431, in iterate_with_context
    next_output = next(iterator)
  File "/Users/stkbailey/Documents/github/dagster-workflows-core/.venv/lib/python3.9/site-packages/dagster/_core/execution/plan/compute_generator.py", line 73, in _coerce_solid_compute_fn_to_iterator
    result = fn(context, **kwargs) if context_arg_provided else fn(**kwargs)
  File "dev.py", line 9, in asset_using_config
    <http://context.log.info|context.log.info>(f'hello {context.op_config["person_name"]}')
s
@Stephen Bailey tried the same and you’re right, it does not work with a default value. Tested on 1.0.4
❤️ 1
s
@sean
s
fixing