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

"TypeError: serverless.classes.Variables is not a constructor" when invoking a test #50

Open
feg624 opened this issue Jul 29, 2022 · 9 comments

Comments

@feg624
Copy link

feg624 commented Jul 29, 2022

When using the following versions:

"serverless": "^3.19.0",
"serverless-jest-plugin": "^0.4.0",

and executing npx sls invoke test

the following error is reported:

Error:
TypeError: serverless.classes.Variables is not a constructor
    at /home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:13:18
    at Promise._execute (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/debuggability.js:384:9)
    at Promise._resolveFromExecutor (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:518:18)
    at new Promise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:103:10)
    at runTests (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:8:3)
    at ServerlessJestPlugin.<anonymous> (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/index.js:97:23)
    at ServerlessJestPlugin.tryCatcher (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromiseCtx (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:641:10)
    at _drainQueueStep (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:97:12)
    at _drainQueue (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (node:internal/timers:466:21)
    at process.topLevelDomainCallback (node:domain:152:15)
    at process.callbackTrampoline (node:internal/async_hooks:128:24)

It seems that on file run-tests.js, the lines 13 and 14 are not needed with the latest version of serverless.

@nomurashunta
Copy link

+1 I have exactly the same problem.

@bdelamotte
Copy link

+1 same problem. Can I create a PR just deleting those lines?

@EmmanDizon
Copy link

encountering the same problem +1

@EmmanDizon
Copy link

@bdelamotte can you create pull request to fix this issue ?

@FaridSafi
Copy link

+1

1 similar comment
@ZentPeople
Copy link

+1

@leosantosw
Copy link

+1
Jest version: ~29.3.1
serverless-jest-plugin version: ~0.4.0

Error:
TypeError: Class extends value # is not a constructor or null

@mehradnia
Copy link

mehradnia commented Apr 9, 2023

Same problem.

"jest": "^29.5.0"
"serverless-jest-plugin": "^0.4.0"
`TypeError: serverless.classes.Variables is not a constructor`

@wjziv
Copy link

wjziv commented Apr 18, 2023

It should be noted that the in the serverless library, the last reference to Serverless.classes.Variables is established in version 2.72.3.

This library does not appear to be updated for v3 of serverless, despite it's been out for more than a year now.

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

9 participants