Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 07 02:18
    dependabot[bot] labeled #464
  • Jan 07 02:18
    dependabot[bot] opened #464
  • Jan 07 02:18

    dependabot[bot] on npm_and_yarn

    Bump json5 from 1.0.1 to 1.0.2 … (compare)

  • Dec 07 2022 17:44
    dependabot[bot] labeled #463
  • Dec 07 2022 17:44
    dependabot[bot] opened #463
  • Dec 07 2022 17:44

    dependabot[bot] on npm_and_yarn

    Bump qs and body-parser Bumps … (compare)

  • Dec 02 2022 01:40
    dependabot[bot] labeled #462
  • Dec 02 2022 01:40
    dependabot[bot] opened #462
  • Dec 02 2022 01:40

    dependabot[bot] on npm_and_yarn

    Bump decode-uri-component from … (compare)

  • Nov 22 2022 19:03
    dependabot[bot] labeled #461
  • Nov 22 2022 19:03

    dependabot[bot] on npm_and_yarn

    Bump engine.io and karma Bumps… (compare)

  • Nov 22 2022 19:03
    dependabot[bot] opened #461
  • Nov 11 2022 13:55
    dependabot[bot] labeled #460
  • Nov 11 2022 13:55

    dependabot[bot] on npm_and_yarn

    Bump loader-utils from 1.2.3 to… (compare)

  • Nov 11 2022 13:55
    dependabot[bot] opened #460
  • Oct 29 2022 10:33

    dependabot[bot] on npm_and_yarn

    (compare)

  • Oct 29 2022 10:33
    dependabot[bot] closed #452
  • Oct 29 2022 10:33
    dependabot[bot] commented #452
  • Oct 29 2022 10:33
    dependabot[bot] labeled #459
  • Oct 29 2022 10:33
    dependabot[bot] opened #459
AlexSerrano22
@AlexSerrano22
Hi guys, I'm trying to create a basic containers (documents) but when I try to create a couple of this documents one after another I receive this error:
I'm using this code:
let something = {};
      carbon.documents.createChild( "/", something, "users" ).then(
        ( [ persistedProject, response ] ) => {
          console.log( project === persistedProject ); // true
          console.log( project.id ); // document's URI
        }
      ).catch( console.error );
my question is: the sdk have a restriction of time or I'm missing some code?
Miguel Aragón
@MiguelAraCo
You are trying to create the same child several times
That's why you are receiving a 409 Conflict
That code is trying to create the document /users/
Or was it only an example?
AlexSerrano22
@AlexSerrano22
no, because I'm replacing the slug, the first time I use "users" as a slug and the second one I set "role" and the "users" document is created, but the "role" document is not.
Miguel Aragón
@MiguelAraCo
Whenever you create a document, the platform locks the parent of the document while it is being created. So if you send two (or more) consecutive requests, there is a chance you'll receive a 409 Conflict
AlexSerrano22
@AlexSerrano22
yeap, this is only an example of the code that I'm using and the variable something is cleaned before run the createChild function every time
Miguel Aragón
@MiguelAraCo
In practice, this shouldn't happen as the second request waits a little bit for the parent document to release the lock
Basically, on almost any ajax request (and this doesn't just apply to Carbon) it is a good idea to setup a retry system in case something goes wrong. In this case, that request can be retried and it will eventually succeed.
AlexSerrano22
@AlexSerrano22
ok, let me search into the sdk documentation to know is you have some function that I could use to ask about the status of the document like if is locked or free
Miguel Aragón
@MiguelAraCo
Still, I'll look into it as it shouldn't happen with just two requests
I would advise you to check the error and just retry the request
Instead of trying to see if the document is locked
Are you waiting for the promise to finish, or are you sending both of them at the same time?
AlexSerrano22
@AlexSerrano22
I'm waiting for the promise when this is resolved, I try to create the next document
Miguel Aragón
@MiguelAraCo
Could you paste your code?
AlexSerrano22
@AlexSerrano22
yeap give me some minutes
AlexSerrano22
@AlexSerrano22

I'm using vue, I write this code on the app.vue and I'm using the hot reload, any time that some change is detected the app is reloaded..

CarbonService.createDocument: function(carbon, rootPath, document, slug ){
    return carbon.documents.createChild( "/"+rootPath, document, slug );
}

let carbon = CarbonService.init();
let something = {};
let slug = "users";

CarbonService.createDocument(carbon, "/", something, slug).then(
( [ persistedProject, response ] ) => {
    console.log( something === persistedProject ); // true
    console.log( something.id ); // document's URI
}
).catch( console.error );

I run the script to create a document and I wait to see on the browser console the log of true and document URI, after that I'm going to my code again and change the slug variable to this:

CarbonService.createDocument: function(carbon, rootPath, document, slug ){
    return carbon.documents.createChild( "/"+rootPath, document, slug );
}

let carbon = CarbonService.init();
let something = {};
let slug = "roles";

CarbonService.createDocument(carbon, "/", something, slug).then(
( [ persistedProject, response ] ) => {
    console.log( something === persistedProject ); // true
    console.log( something.id ); // document's URI
}
).catch( console.error );

the app is reloaded and run the script again, and is there where I see the 409 error on the browser console.

Miguel Aragón
@MiguelAraCo
I just replicated your issue and identified the cause
There' s a bug in the SDK that is triggering this behavior
AlexSerrano22
@AlexSerrano22
cool, do you need that I post this on github?
Miguel Aragón
@MiguelAraCo
Well, the bug we found may not be causing your issue after all
In your code, the requests are being sent to //
Because of this: "/"+rootPath
AlexSerrano22
@AlexSerrano22
sorry this was my error when I sent you the code, currently, I only send the "/"
Miguel Aragón
@MiguelAraCo
:+1:
Can you open your developer tools and send us a screenshot of the requests being sent?
AlexSerrano22
@AlexSerrano22
sure, one moment
AlexSerrano22
@AlexSerrano22
ammm I thought about other things that I did yesterday, and another thing that I did was delete a document on the workbench and after that, I begin to see the error logs, and I understand that is because the parent document was "locked". probably this was the cause of the error. but how I can know if the parent document is locked, what happens if some request is sent to create a child in the same parent document? Will I re-send the request until the document can be created?
Miguel Aragón
@MiguelAraCo
Documents should only be locked while something is being done to them
So if you perform an action, that action finishes, and the document is still locked, there's an issue with the platform
Even then the lock expires after a few minutes
Right now there isn't a direct way to check if a document is locked other than trying something and receiving a 409
It is an internal mechanism after all
Normally you would program a retry mechanism with a configurable delay and a number of retries before failing
For now, you can remove any dead locks your platform may have by following these steps:
  • Shut down your platform: docker stop <container-name>
  • Delete the directory: <carbon-directory>/data/zookeeper
  • Start your platform again: docker start <container-name
Like I said, this shouldn't happen, so please let us know if a lock isn't being released and the steps you took to get there
AlexSerrano22
@AlexSerrano22
I think the platform works as designed because after a few minutes I was able to create a document, but thanks for clarifying me why I receive the 409 error. :)
Miguel Aragón
@MiguelAraCo
Nice :+1:
Thanks for reaching out :smile:
Miguel Aragón
@MiguelAraCo
Just published a new version v1.0.0-alpha.8 that fixes a minor bug. Please update your projects to use this version if you are using the alpha line
AlexSerrano22
@AlexSerrano22
cool, thanks
Alex Arriaga
@alex-arriaga
Hi, we are interested in migrating data from a previous Carbon LDP version; at this moment, we exported the data into JSON files and we are going to make some scripting to insert all that data in another Carbon instance…
Is that the right/shortest path?
We think the export/import process would not be compatible between legacy versions and the newest Alpha, right?
Miguel Aragón
@MiguelAraCo
Yes, the import/export mechanism we had on the previous version isn't compatible with the new one
There's no migration path yet