Back

Cannot read properties of undefined (reading 'replace')

  • 0
  • Web
  • Cloud
Starco
2 Sep, 2024, 01:14

I got this error on JavaScript latest version with Appwrite Cloud version 15.0.0.

  • Error : C:\Users\syafi\OneDrive\Documents\Work\LESS24H\REST API\node_modules\appwrite\dist\cjs\sdk.js:267 this.config.endpointRealtime = this.config.endpointRealtime || this.config.endpoint.replace('https://', 'wss://').replace('http://', 'ws://'); ^

TypeError: Cannot read properties of undefined (reading 'replace') at Client.setEndpoint (C:\Users\syafi\OneDrive\Documents\Work\LESS24H\REST API\node_modules\appwrite\dist\cjs\sdk.js:267:93) at Object.<anonymous> (C:\Users\syafi\OneDrive\Documents\Work\LESS24H\REST API\lib\appwrite\index.js:9:29) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:121:18) at Object.<anonymous> (C:\Users\syafi\OneDrive\Documents\Work\LESS24H\REST API\lib\appwrite\database\listDocument.js:2:23) at Module._compile (node:internal/modules/cjs/loader:1256:14)

Node.js v18.17.1

TL;DR
Developers encountered an error "Cannot read properties of undefined (reading 'replace')" when using JavaScript latest version with Appwrite Cloud version 15.0.0. The issue was traced to a specific line in the code where 'replace' was being used on an undefined property. The solution is to verify and ensure that the 'this.config.endpoint' property is defined before accessing its properties.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more