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.

PreTokenGenerationTriggerEvent => claims_to_suppress : NoneType' object does not support item assignment

See original GitHub issue

What were you trying to accomplish? I’m currently trying to add some claims to suppress to the token in the event object. Working with manual way (without your lib).

Expected Behavior

No exception

Current Behavior

Exception

Possible Solution

Steps to Reproduce (for bugs)

def handler(event, context):
    event: PreTokenGenerationTriggerEvent = PreTokenGenerationTriggerEvent(event)
    user_pool_id = event.user_pool_id
    claims_override_details = event.response.claims_override_details
    claims_override_details.claims_to_suppress = ["Email"]

Environment

  • Powertools version used: 1.22.0
  • Packaging format (Layers, PyPi):
  • AWS Lambda function runtime: Python 3.9
  • Debugging logs
    "exception": "Traceback (most recent call last):\n  File \"/var/task/main.py\", line 130, in handler\n    claims_override_details.claims_to_suppress = []\n  File \"/var/task/package/aws_lambda_powertools/utilities/data_classes/cognito_user_pool_event.py\", line 487, in claims_to_suppress\n    self._data[\"claimsToSuppress\"] = value\nTypeError: 'NoneType' object does not support item assignment"

How to enable debug mode**

2021-12-05 21:13:10,898 aws_lambda_powertools.logging.logger [DEBUG] Adding filter in root logger to suppress child logger records to bubble up
2021-12-05 21:13:10,898 aws_lambda_powertools.logging.logger [DEBUG] Marking logger service_undefined as preconfigured

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
filolcommented, Dec 9, 2021

Hi @michaelbrewer, I don’t have the event right now on the hand. I will come back to you with my sample monday

1reaction
filolcommented, Dec 16, 2021

@michaelbrewer There is my event from aws, so yes claimsOverrideDetails is null by default

{
    "version": "1",
    "triggerSource": "TokenGeneration_RefreshTokens",
    "region": "eu-west-1",
    "userPoolId": "eu-west-1_xxxxxxxxx",
    "userName": "xxxxxxxxxx",
    "callerContext": {
        "awsSdkVersion": "aws-sdk-unknown-unknown",
        "clientId": "xxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "request": {
        "userAttributes": {
            "sub": "c7605922-xxxx-xxxx-a402-881ba30eeabc",
            "zoneinfo": "UTC",
            "cognito:email_alias": "xxxx",
            "cognito:user_status": "CONFIRMED",
            "email_verified": "true",
            "phone_number_verified": "false",
            "family_name": "xxxx",
            "email": "xxxx"
        },
        "groupConfiguration": {
            "groupsToOverride": [
                "xxx",
                "xxx",
            ],
            "iamRolesToOverride": [],
            "preferredRole": null
        }
    },
    "response": {
        "claimsOverrideDetails": null
    }
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

'NoneType' object does not support item assignment, even ...
I am self working on an inventory system project, and currently trying to edit key values in my list of dictionaries. When trying...
Read more >
TypeError: 'NoneType' object does not support item assignment
Since the plugin active, began to appear the following errors in the debug log trac: 0.11.7 and 0.12.5 happens in. Trac[main] ERROR: Exception...
Read more >
Chapter 7 questions - Course - Hugging Face Forums
Hi - this is a relatively simple question but i'm totally new to ... TypeError: 'NoneType' object does not support item assignment.
Read more >
TypeError: 'NoneType' object does not support item ...
During tests with the current python-openstackclient master, we get the following error: ERROR: openstackclient.shell Traceback (most recent ...
Read more >
'None Type' object does not support item assignment - Intellipaat
The issue is being caused because in your function makeNewFish() you are not returning anything. I think you should return the variable fi....
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