amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to set multiple segments in base path

ianzone opened this issue Β· comments

commented

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Bug Report

Error Description
When set multiple segments in basePath, the api is recognized as V2, even though it's a rest api (V1).

Command Run
sls deploy

Console Output

βœ– Stack meeting-dev failed to deploy (135s)
Environment: linux, node 18.16.0, framework 3.31.0 (local) 3.31.0v (global), plugin 6.2.3, SDK 4.3.2
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: V2 - Unable to create base path mapping for 'demo-service.tin.info':
Only REGIONAL domain names can be managed through the API Gateway V2 API. For EDGE domain names, please use the API Gateway V1 API. Also note that only REST APIs can be attached to EDGE domain names.
    at APIGatewayV2Wrapper.<anonymous> (/home/ian/acte/roomzz-v1/api/meeting/node_modules/.pnpm/serverless-domain-manager@7.0.4_serverless@3.31.0/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:118:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/ian/acte/roomzz-v1/api/meeting/node_modules/.pnpm/serverless-domain-manager@7.0.4_serverless@3.31.0/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:6:65)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Domain Manager Configuration
using serverless.ts

    customDomain: {
      // https://github.com/amplify-education/serverless-domain-manager
      domainName: '${param:domain}',
      certificateName: '${env:Certificate_Name}',
      basePath: 'meeting/${sls:stage}',
      autoDomain: true,
      preserveExternalPathMappings: true,
    },

Versions

  • Domain Manager version(s): ^7.0.4
  • Node/pnpm version: 18.16.0/8.5.1
  • Serverless Version: 3.31.0
  • Lambda Code Javascript

Hi @ianzone

The error says that you are using EDGE endpoint type.
Could you please switch to the REGIONAL?

commented

but I am using the apigateway V1 and meant to use the EDGE endpoint

  functions: {
    api: {
      handler: 'dist/api.handler',
      events: [
        {
          http: {
            method: 'ANY',
            path: '/',
            cors: true, // https://www.serverless.com/framework/docs/providers/aws/events/apigateway#enabling-cors
          },
        },
        {
          http: {
            method: 'ANY',
            path: '{proxy+}',
            cors: true, // https://www.serverless.com/framework/docs/providers/aws/events/apigateway#enabling-cors
          },
        },
      ],
    },