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

Feature request: Support DisableExecuteApiEndpoint for Serverless::HttpApi with DefinitionUri #3128

Closed
LesUski opened this issue Apr 25, 2023 · 2 comments
Assignees
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/feature

Comments

@LesUski
Copy link

LesUski commented Apr 25, 2023

Support DisableExecuteApiEndpoint: true when creating AWS::Serverless::HttpApi with DefinitionUri.

Proposal

When running sam validate on a template with resource Serverless::HttpApi with DefinitionUri property allow disabling the execute API endpoint.

template.yaml

HttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
        DefinitionUri:
            Bucket: !Ref Bucket
            Key: 'openapi.yaml'
        DisableExecuteApiEndpoint: true

That raises error: `[InvalidResourceException('HttpApi', "DisableExecuteApiEndpoint works only within 'DefinitionBody' property.")]

The alternative way with 'DefinitionBody' property doesn't solve the problem instead leads to another one. When trying to create HttpApi with:

template.yaml

HttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
        DefinitionBody:
            'Fn::Transform':
                Name: 'AWS::Include'
                Parameters:
                    Location: './openapi.yaml'
        DisableExecuteApiEndpoint: true

Another error is being raised: [InvalidTemplateException("Invalid OpenApi document. Invalid values or missing keys for 'openapi' or 'paths' in 'DefinitionBody'.")]

openapi.yaml

openapi: 3.0.1
info:
    title: 'api'
    version: '1.0'
    description: test
paths:
    /hello:
        get:
...

Additional Details

SAM CLI, version 1.81.0

@LesUski LesUski added stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/feature labels Apr 25, 2023
@LesUski LesUski changed the title Feature request: Support DisableExecuteApiEndpoint with Serverless::HttpApi with DefinitionUri Feature request: Support DisableExecuteApiEndpoint for Serverless::HttpApi with DefinitionUri Apr 25, 2023
@sriram-mv
Copy link
Contributor

aws-sam-translator powers sam validate. I'm moving this issue to the aws sam translator repository.

@sriram-mv sriram-mv transferred this issue from aws/aws-sam-cli Apr 25, 2023
@aaythapa aaythapa self-assigned this Apr 26, 2023
@aaythapa
Copy link
Contributor

aaythapa commented Apr 26, 2023

Hi @CloudedThings, thanks for reporting this.

When you define DisableExecuteApiEndpoint it doesn't actually get passed through to the DisableExecuteApiEndpoint property of an AWS::ApiGatewayV2::Api resource. It gets passed into the x-amazon-apigateway-endpoint-configuration OpenApi extension instead (our docs are don't reflect this yet, we'll be updating them). So when you use DisableExecuteApiEndpoint with DefinitionUri we can't change the OpenApi definition, thus we can't add the extension.

Using DisableExecuteApiEndpoint with DefinitionBody, we should be able to change the OpenApi definition. I used your template and was able to reproduce the error message. Seems the issue was related to the intrinsic rather than the property. Using the AWS::LanguageExtensions transform made the template deployable and should work for you as well (see #2533 for more info on language extensions).

Closing this issue for now, please re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/feature
Projects
None yet
Development

No branches or pull requests

3 participants