WP-API / node-wpapi

An isomorphic JavaScript client for the WordPress REST API
http://wp-api.org/node-wpapi/
MIT License
1.68k stars 191 forks source link

TypeError: this.transport.get is not a function #481

Closed MartinSchere closed 3 years ago

MartinSchere commented 3 years ago

I'm trying to deploy a node script on google cloud functions but I keep getting this error. It works perfectly fine locally, but the log of the function outputs the following: TypeError: this.transport.get is not a function at EndpointRequest.WPRequest.then (/workspace/node_modules/wpapi/lib/constructors/wp-request.js:776:24) at processTicksAndRejections (internal/process/task_queues.js:97:5) E callme uh3svoyqbl4j 2021-02-19 23:42:49.692 Error: Process exited with code 16 at process.<anonymous> (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:275:22) at process.emit (events.js:327:22) at process.EventEmitter.emit (domain.js:483:12) at process.exit (internal/process/per_thread.js:167:15) at Object.sendCrashResponse (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/logger.js:37:9) at process.<anonymous> (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:271:22) at process.emit (events.js:315:20) at process.EventEmitter.emit (domain.js:483:12) at processPromiseRejections (internal/process/promises.js:209:33) at processTicksAndRejections (internal/process/task_queues.js:98:32)

mh4ck commented 3 years ago

Any solution fot that?

MartinSchere commented 3 years ago

Yup, it was just the wrong import. Docs are updated, so just import it as indicated

kadamwhite commented 3 years ago

Glad to hear it seems to be sorted, closing issue