Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While using s3.get_public_access_block(Bucket=bucket_name) in AWS lambda NoSuchPublicAccessBlockConfiguration error comes up #3627

Closed
aditisri07 opened this issue Mar 13, 2023 · 6 comments
Assignees
Labels
p3 This is a minor priority issue s3

Comments

@aditisri07
Copy link

Describe the bug

The error:

An error occurred (NoSuchPublicAccessBlockConfiguration) when calling the GetPublicAccessBlock operation: The public access block configuration was not found.

Observation: The command seems to be working fine when the buckets are not public and the error is received when it is public.

Version of boto3 used: 1.20.32
Version of botocore used: 1.23.32

image

Expected Behavior

Expected it to return the response in following format
{
'PublicAccessBlockConfiguration': {
'BlockPublicAcls': True|False,
'IgnorePublicAcls': True|False,
'BlockPublicPolicy': True|False,
'RestrictPublicBuckets': True|False
}
}

Current Behavior

throwing the following error:
An error occurred (NoSuchPublicAccessBlockConfiguration) when calling the GetPublicAccessBlock operation: The public access block configuration was not found.

when a public bucket is passed in its parameter

Reproduction Steps

public_access_block_response = s3.get_public_access_block(Bucket='bucket_name')

where bucket_name is public

Possible Solution

No response

Additional Information/Context

No response

SDK version used

Python 3.9

Environment details (OS name and version, etc.)

AWS lambda

@aditisri07 aditisri07 added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Mar 13, 2023
@aBurmeseDev aBurmeseDev self-assigned this Mar 14, 2023
@aBurmeseDev aBurmeseDev added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 14, 2023
@aBurmeseDev
Copy link
Contributor

Hi @aditisri07 - thanks for reaching out.

Public access is not enabled by default on initial bucket creation and can be updated via AWS Console under your bucket permission settings. Please see screenshot below for reference.
Screen Shot 2023-03-14 at 12 22 36 PM

Hope it helps,
John

@aBurmeseDev aBurmeseDev added response-requested Waiting on additional information or feedback. s3 p3 This is a minor priority issue and removed bug This issue is a confirmed bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Mar 14, 2023
@aditisri07
Copy link
Author

aditisri07 commented Mar 16, 2023

Hey @aBurmeseDev ,

We have set the block all public access for the said bucket to off. It is a public bucket already.
image

@github-actions github-actions bot removed the response-requested Waiting on additional information or feedback. label Mar 16, 2023
@theboyisno-one
Copy link

facing same issue

@hsiam261
Copy link

Was facing the same issue. This can happen if someone manually deleted the public_access_block using a call to the delete-public-access-block api.

> aws s3api get-public-access-block --bucket siam-test-bucket-1
{
    "PublicAccessBlockConfiguration": {
        "BlockPublicAcls": false,
        "IgnorePublicAcls": false,
        "BlockPublicPolicy": false,
        "RestrictPublicBuckets": false
    }
}
> aws s3api delete-public-access-block --bucket siam-test-bucket-1
> aws s3api get-public-access-block --bucket siam-test-bucket-1
An error occurred (NoSuchPublicAccessBlockConfiguration) when calling the GetPublicAccessBlock operation: The public access block configuration was not found

When you delete the public access block, from the aws console, the options look the same as if setting all the options to false.
If you just edit from the console, not change anything and then save, then the public-access-block gets created again and it works as expected again.

@aBurmeseDev
Copy link
Contributor

@hsiam261 - kudos to you for sharing it with others. If anyone's come across this, please refer to the commend above. Closing it for now.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 This is a minor priority issue s3
Projects
None yet
Development

No branches or pull requests

4 participants