robtweed / DPP

Deep Persistent Proxy Objects for JavaScript
91 stars 2 forks source link

DPP doesn't work when running on website hosted on remote server, but works on 'localhost' website #3

Closed hopeng closed 2 years ago

hopeng commented 2 years ago

Hi,

I'm looking for help in troubleshooting. The browser code is very simple and it worked when I run my website hosted in localhost.

import {createDPP} from "dpp-db/node"

clientMapDpp = createDPP({
    storeName: 'clientMap',
    logging: true
  })

this.clientMap = await this.clientMapDpp.start()
this.clientMap["1660733927552"] = {"firstName":"May","lastName":"Ry","gender":"Male","phone":0}

I got these logs

1661774423157: proxy set called with prop = ["1660733927552"]
1661774423157: getProps called for ["1660733927552"]
1661774423158: obj={"firstName":"May","lastName":"Ry","gender":"Male","phone":0}

It worked and I could see IndexedDB got populated with the record.

But this doesn't work when the website runs on remote server and accessed through a custom domain name.

I got exactly the same logging output ('proxy set called with prop' ...) but the IndexedDB just didn't get populated at all. This is very strange. Is there any way to troubleshoot?

robtweed commented 2 years ago

Hi - let's eliminate one potential issue - can you make sure you're using the very latest versions of DPP (2.6.0) and QOper8-ww (2.6.2). There was a change I made to the "this" context when running a WebWorker message type handler script in QOper8-ww which has to be matched in DPP. Using a mismatched combination of DPP and QOper8 versions would certainly cause the kind of fault you've described. Let me know if you still have the issue after checking the versions (take a look in the package.json files for the version numbers)

hopeng commented 2 years ago

works now! will you be able to enforce the expected version of qoper8-ww dependency? So other users will not have this issue:

change this in dpp-db/package.json:

  "dependencies": {
    "qoper8-ww": ""
  },

into

  "dependencies": {
    "qoper8-ww": "2.6.2" // or even "latest"
  },
robtweed commented 2 years ago

Will do! I'll close this now