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

Cannot read property 'enabled' of undefined #3

Closed
Vad1mo opened this issue Nov 8, 2018 · 8 comments
Closed

Cannot read property 'enabled' of undefined #3

Vad1mo opened this issue Nov 8, 2018 · 8 comments
Labels
bug Something isn't working

Comments

@Vad1mo
Copy link

Vad1mo commented Nov 8, 2018

I have a custom certificate but manage the domain with cloudformation and not with the domain plugin

This is the error I get:

TypeError: Cannot read property 'enabled' of undefined
    at CreateCertificatePlugin.evaluateEnabled (/Users/v/Development/si/kickstart/static-website-aws/node_modules/serverless-certificate-creator/index.js:58:65)
    at CreateCertificatePlugin.initializeVariables (/Users/v/Development/si/kickstart/static-website-aws/node_modules/serverless-certificate-creator/index.js:29:27)
    at CreateCertificatePlugin.createCertificate (/Users/v/Development/si/kickstart/static-website-aws/node_modules/serverless-certificate-creator/index.js:99:10)
    at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)```
@schwamster
Copy link
Owner

@Vad1mo I am not sure if I understand the problem. Did you create your domain and the certificate yourself?

@schwamster
Copy link
Owner

schwamster commented Nov 8, 2018

@Vad1mo fyi: the domain plugin is not mutually exclusive with cloudformation, terraform or any other mean of creating your a-records. the domain plugin can simply be used to create the necessary base path mapping with an already existing domain. => https://github.com/amplify-education/serverless-domain-manager (hint: look at the property table: createRoute53Record)

@schwamster schwamster added the question Further information is requested label Nov 8, 2018
@Vad1mo
Copy link
Author

Vad1mo commented Nov 8, 2018

To create the cert I am using serverless-certificate-creator, for the domain we have already a hosted zone. There need to be a subdomain or an alias on the root domain to be created.

I can't use the serverless-domain-manager as the plugin attaches the domain to the api gateway. We are using lambda@edge and need to attach the domain to cloudfront. See amplify-education/serverless-domain-manager#163. So if I don't use the plugin serverless-domain-manager I get the error message as seen above.

@schwamster
Copy link
Owner

can you tell me how your custom/customCertificate serverless config looks like (please without sensitive data )

@Vad1mo
Copy link
Author

Vad1mo commented Nov 8, 2018

Here is the config I am using.

....
plugins:
  - serverless-plugin-cloudfront-lambda-edge
  - serverless-finch
  - serverless-certificate-creator

custom:
  defaultRegion: us-east-1
  defaultEnvironmentGroup: dev
  region: ${opt:region, self:custom.defaultRegion}
  stage: ${opt:stage, 'poc'}
  objectPrefix: '${self:service}-${self:custom.stage}'
  client:
    bucketName: '${self:custom.objectPrefix}'
    distributionFolder: website/
  customCertificate:
    certificateName: 'docs.sandbox.com'
    hostedZoneName: 'sandbox.com.'
    region: ${self:custom.region}
  customDomain:
    enabled: true
....

As you see the

customDomain:
    enabled: true

part is there if not existent I get the above error.

@schwamster
Copy link
Owner

ah snap... now i understand what the problem is :)
copy paste bug

will fix it asap! thanks for pointing it out

@schwamster schwamster added bug Something isn't working and removed question Further information is requested labels Nov 8, 2018
schwamster added a commit that referenced this issue Nov 8, 2018
@schwamster
Copy link
Owner

just published 1.0.4 => https://www.npmjs.com/package/serverless-certificate-creator/v/1.0.4
@Vad1mo can you verify that it works for you?

@Vad1mo
Copy link
Author

Vad1mo commented Nov 9, 2018

Works great thank you. ❤️

@Vad1mo Vad1mo closed this as completed Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants