Live-export not updating in real time

Followed the video, did all the steps with integrating inkdrop, but the app won’t open when I make the necessary changes to the config.cson file. It gives me a config error window saying “failed to load config.cson” then a longer window “Failed to start app” must have done something wrong, just would like to know where. I am also using the blog post to make sure I didn’t miss anything, but it refuses to load regardless.

Update: I tried to remove the lines from the config file, it still crashed so I have to re-install.

Environment

  • Platform: macOS/
  • Platform version: Ventura 13.3.1
  • App Version: 5.5.3

How to reproduce

Hi Dave,

Thanks for the question.
There must be a syntax error in your config file.
Can you share a screenshot of the error message and your config file?

Hey Takuya,

I have re-installed the app so everything is back to default. I will redo the config file, but my big question is: should I be changing anything when inputting everything or keep it exactly how you have it.

What do you mean by ‘keep it exactly how you have it’? Please be specific so I can understand your issue.

Ok it works, but its not updating in real time like its supposed to be. It needs to restart for it to grab new updates.

Did you specify live: true?

Where would I find that to check? config.cson has enabled: true but I don’t recall anywhere in the project that has live: true, unless I missed that.

Please read the documentation.

Thank you I didn’t look at that documentation. I do have live: true in import.mjs, and “live-import”: “node --experimental-vm-modules tools/import.mjs” in package.json. Is it possible my updated dependencies had any impact on why it’s not updating in real time, meaning my versions are more recent compared to when you made the video.

There were no breaking changes in the module, so it should be working.
Does your import.mjs quit immediately or keep running?

If it keeps running, you can try pressing Cmd-S to manually save the note on the app and see if it gets exported to your project.

If it doesn’t, there may be something going wrong.
You can enable verbose logging to debug your script in this case.

Where does the log output to for me to see for sure, because it looks as if you are correct. Even when I manually save nothing gets sent through until I restart it. But nowhere gives me any errors for me to see why.

Can you share your import.mjs or your repo? It sounds impossible to find what’s going wrong without seeing your code or setup.

Yes of course, here is the repo for my astro blog.

https://github.com/Millz98/astro

Thanks for sharing your repo. Okay, so your import.mjs looks identical to mine.

By adding the following env variable to your .env file:

DEBUG='inkdrop:export:info,inkdrop:export:error'

The logs should be output in the terminal something like:

Screenshot 2023-05-18 at 12.55.22

If you set the variable like so:

DEBUG='*'

It yields the most verbose logs like this:

As you can see, it periodically checks the changes.

I followed along with your video to learn, so I was hoping to yield the same results. My .env file has the Debug set to

DEBUG=‘inkdrop:export:info,inkdrop:export:error’

And it doesn’t show anything except the last changes it pushed through. I will change it to the other way and see if it gives me any errors as to why its not updating in real time.

Update: So its registering that there is a change every time I wrote something and synced manually.

results: [ { id: 'note:SmKOd_wq2', changes: [Array], seq: 96 } ],
  last_seq: 96
} +5ms
  inkdrop:export:debug response: { results: [], last_seq: 96 } +511ms

But the change never goes to the site until I turn live-import off and then run it again.

When it detects a change, you should see logs like so:

  inkdrop:export:debug response: {
  results: [
    {
      id: 'note:173lIvZ40',
      changes: [Array],
      doc: [Object],
      seq: 20926
    }
  ],
  last_seq: 20926
} +495ms
  inkdrop:export:info Exporting note: note:173lIvZ40 Majextand +24s
  inkdrop:export:debug tree: {
    "type": "root",
    "children": [
        {
            "type": "yaml",
            "value": "description: \"Laptop stand\"\npublic: true",
            "position": {
                "start": {

Do you mean you don’t see the log “Exporting note” or “tree: {”?

I found that the doc field is missing in your changes feed for some reason, which is strange:

results: [ { id: 'note:SmKOd_wq2', changes: [Array], seq: 96 } ],
  last_seq: 96
}

It should be instead like:

results: [ { id: 'note:SmKOd_wq2', changes: [Array], doc: [Object], seq: 96 } ],
  last_seq: 96
}

I’ve published @inkdropapp/live-export@0.2.1, which outputs more verbose debug output for the API calls.
Could you try it?

I scrolled through the entire log and didn’t see any of what you mentioned.

Sure I will try it and would you like me to send you the entire log when I am trying to send the changes?

UPDATE:

I updated my packages, live-import is sitting at 0.1.8 on my macbook after doing a update for all packages, and now I am trying to start it but I keep getting this.

node:internal/deps/undici/undici:11522
Error.captureStackTrace(err, this);
^

TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11522:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async LiveExporter.callApi (file:///Users/davemills/Documents/astro/node_modules/@inkdropapp/live-export/lib/index.js:31:26)
at async LiveExporter.start (file:///Users/davemills/Documents/astro/node_modules/@inkdropapp/live-export/lib/index.js:277:22)
at async file:///Users/davemills/Documents/astro/tools/import.mjs:16:1 {
cause: Error: connect ECONNREFUSED 127.0.0.1:19840
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1571:16) {
errno: -61,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘127.0.0.1’,
port: 19840
}
}

Node.js v20.1.0
error Command failed with exit code 1.

UPDATE #2, updated to 0.2.1 and its still giving me that error on starting it. completely not sure why.

UPDATE #3: After going through almost everything, it is now working again…except it’s still not updating in real time. I am very much loving how more detailed the debug output is, but there is still no real indication as to why its not updating in real time.

didn’t see any of what you mentioned

So, you don’t get any logs??
I’m afraid that I have no idea what’s going on in your environment.

would you like me to send you the entire log

yes, please. Make sure specifying DEBUG='*' for the most verbose logs.

What I meant in my last reply is that when I make a change, the code you provided that I should be seeing when a change is made never comes on the screen, but that’s probably because its not taking the changes in real time.

Would you like me to post the log on here, or email it to you?

Yes, I need to understand the whole context anyway.
If it’s going to be a huge log file, you can email me at: t@inkdrop.app