Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot set property graph of #<Quad> which has only a getter #137

Closed
yhdelgado opened this issue Apr 21, 2021 · 2 comments · Fixed by #138
Closed

TypeError: Cannot set property graph of #<Quad> which has only a getter #137

yhdelgado opened this issue Apr 21, 2021 · 2 comments · Fixed by #138
Assignees
Labels

Comments

@yhdelgado
Copy link

I am trying to deploy ldf-server in my shared hosting using the latest version of the package. After executed ldf-server config.json everything is ok, but after the first request to the server, the process exit and throw the following error:

@ldf/core/lib/datasources/Datasource.js:150
      quad.graph = quad.graph && quad.graph.termType !== 'DefaultGraph' ? quad.graph : (graph || quad.graph);
                 ^
TypeError: Cannot set property graph of #<Quad> which has only a getter
    at SimpleTransformIterator._map

To reproduce the error:

You can reproduce the problem by trying the following.

  1. npm install -g @ldf/server
  2. ldf-server config.json

Here my config.json file:

{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@ldf/server/^3.0.0/components/context.jsonld",
  "@id": "urn:ldf-server:my",
  "import": "preset-qpf:config-defaults.json",

  "title": "Linked Data Fragments server",
  "port": 30000,
  "workers": 1,
  "protocol": "http",

  "datasources": [
    {
      "@id": "ex:linkedDlsource",
      "@type": "HdtDatasource",
      "datasourceTitle": "LinkedDL 2021",
      "description": "Short description here",
      "datasourcePath": "linkeddl",
      "hdtFile": "data/raw-data.hdt"
    }
 ]
}

Note: I downloaded the source code from github.com and installed it. Everything works as expected. Same HDT file and config file. For some reason, compiling from source code works fine, but from the npm registry doesn't.

@rubensworks
Copy link
Member

Thanks for reporting.

This looks like a bug because of illegal quad modifications (whereas they are to be considered immutable): https://github.com/LinkedDataFragments/Server.js/blob/master/packages/core/lib/datasources/Datasource.js#L141-L150

@Dexagod I think you wrote this code, could you look into this one?

rubensworks pushed a commit that referenced this issue May 10, 2021
* Fix error caused by updating immutable object

* Fixed assignment to immutable quad object. Updated default dataFactory lib to recent version and updated tests

* Small code cleanup

* Removed unnecessary variable declarations
@rubensworks
Copy link
Member

Fix released as 3.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants