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

0.28.2 causes runtime error: Cannot use in operator to search for excludeEmptyString #799

Closed
Albert-Gao opened this issue Mar 6, 2020 · 1 comment

Comments

@Albert-Gao
Copy link

Albert-Gao commented Mar 6, 2020

I have a lib uses tsdx to build a module to consume at the backend (AWS Lambda running on Node 12.x), then build with tsc by Typescript 3.8.

Today, I updated to 0.28.2 and get the following error message

{
    "errorType": "TypeError",
    "errorMessage": "Cannot use 'in' operator to search for 'excludeEmptyString' in At least 8 characters longs, with Lower case letters (a-z), Upper case letters (A-Z), Numbers (0-9) and Special characters (!@#$%^&*()-+_=,.?/;:'\").",
    "stack": [
        "TypeError: Cannot use 'in' operator to search for 'excludeEmptyString' in At least 8 characters longs, with Lower case letters (a-z), Upper case letters (A-Z), Numbers (0-9) and Special characters (!@#$%^&*()-+_=,.?/;:'\").",
        "    at StringSchema.matches (/var/task/node_modules/yup/lib/string.js:107:51)",
        "    at Object.<anonymous> (/var/task/node_modules/@albert-gao/teaming-cloud-shared/dist/teaming-cloud-shared.cjs.development.js:46:14)",
        "    at Module._compile (internal/modules/cjs/loader.js:955:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)",
        "    at Module.load (internal/modules/cjs/loader.js:811:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:723:14)",
        "    at Module.require (internal/modules/cjs/loader.js:848:19)",
        "    at Module._require.o.require (/var/task/serverless_sdk/index.js:9:91865)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at Object.<anonymous> (/var/task/node_modules/@albert-gao/teaming-cloud-shared/dist/index.js:7:20)"
    ]
}

The line it refers:

const ERR_MSG = `At least 8 characters longs, with Lower case letters (a-z), Upper case letters (A-Z), Numbers (0-9) and Special characters (!@#$%^&*()-+_=,.?/;:'").`

const password = string()
  .matches(REGEX.PASSWORD, ERR_MSG)
  .required()

The source code is here:
27e5d68#diff-57c5960218f1091895b3610a7d779378

by changing from

options.hasOwnProperty('excludeEmptyString')

to

'excludeEmptyString' in options

It causes the error, seems pretty strange.

@Albert-Gao Albert-Gao changed the title 0.28.2 causes runtime error 0.28.2 causes runtime error: Cannot use in operator to search for excludeEmptyString Mar 6, 2020
@RudiPersson
Copy link

Duplicate of #798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants