amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.
MIT License
938 stars 233 forks source link

Unable to create basepath mapping after upgrade to v3.0.4 #192

Closed esetnik closed 5 years ago

esetnik commented 5 years ago

I have two domains x.domain.co and y.domain.co. Until the update to v3.0.4 serverless-domain-manager was properly creating base path mappings for both domains. Now, only deployments to stage production work and deployments to stage dev are met with a Unable to create basepath mapping error. Previously both dev and production worked. When I look at API Gateway and view the already configured basepath mappings for each domain they appear to be correct and identical.

screen shot 2019-02-06 at 10 49 50 pm screen shot 2019-02-06 at 10 51 08 pm
custom:
  domains:
    production: x.domain.co
    dev: y.domain.co
  customDomain:
    domainName: '${self:custom.domains.${self:provider.stage}}'
    basePath: ''
    stage: '${self:provider.stage}'
    createRoute53Record: true
Serverless: [AWS cloudformation 200 0.118s 0 retries] describeStackResources({ StackName: 'api-dev' })
Serverless: [AWS apigateway 409 0.143s 0 retries] createBasePathMapping({ basePath: '(none)',
  domainName: 'y.domain.co',
  restApiId: 'ad8kkqo9l2',
  stage: 'dev' })

  Error --------------------------------------------------

  Error: Unable to create basepath mapping.

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: Error: Unable to create basepath mapping.

at ServerlessCustomDomain.<anonymous> (/builds/app/api/node_modules/serverless-domain-manager/dist/index.js:434:23)
    at Generator.throw (<anonymous>)
    at rejected (/builds/app/api/node_modules/serverless-domain-manager/dist/index.js:5:65)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
From previous event:
    at Request.callback (/builds/app/api/node_modules/superagent/lib/node/index.js:716:12)
    at parser (/builds/app/api/node_modules/superagent/lib/node/index.js:916:18)
    at IncomingMessage.res.on (/builds/app/api/node_modules/superagent/lib/node/parsers/json.js:19:7)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickDomainCallback (internal/process/next_tick.js:219:9)
From previous event:
    at PluginManager.invoke (/builds/app/api/node_modules/serverless/lib/classes/PluginManager.js:400:22)
    at PluginManager.run (/builds/app/api/node_modules/serverless/lib/classes/PluginManager.js:431:17)
    at variables.populateService.then.then (/builds/app/api/node_modules/serverless/lib/Serverless.js:114:33)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Serverless.run (/builds/app/api/node_modules/serverless/lib/Serverless.js:101:6)
    at serverless.init.then (/builds/app/api/node_modules/serverless/bin/serverless:43:28)
    at /builds/app/api/node_modules/graceful-fs/graceful-fs.js:111:16
    at /builds/app/api/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at initializeErrorReporter.then (/builds/app/api/node_modules/serverless/bin/serverless:43:6)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at /builds/app/api/node_modules/serverless/bin/serverless:28:46
    at Object.<anonymous> (/builds/app/api/node_modules/serverless/bin/serverless:67:4)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           8.15.0
     Serverless Version:     1.37.0

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Update: I deleted the base path mapping from the offending domain manually and then reran npx sls deploy --stage dev and the basepath mapping was created correctly and is now working. I'm not sure why it stopped working in the first place.

captainsidd commented 5 years ago

Hi there!

We've run into a couple issues with our 3.0.4 release, so we're unpublishing it. We'll keep you in the loop when we publish a fix, but for now you should revert to using 2.6.13 to be able to deploy your code.

esetnik commented 5 years ago

Ok thanks for the update

captainsidd commented 5 years ago

Hi @esetnik -

We've released our fixes to this issue as v3.1.0-beta.0. It's tagged as a beta, so you'll need to explicitly specify the version when installing it. If you have the time, we'd really appreciate it if you could try using 3.1.0-beta.0 in your development workflows - would definitely help with finding issues that we may have missed.

Thanks!