Honey Shah
Honey Shah

Reputation: 421

In composer rest server, PUT request is throwing Cannot read property 'productId' of undefined in multiuser mode

I am using composer version 0.19.12 and fabric 1.1

Composer rest server is throwing Cannot read property 'productId' of undefined when not passing id(unique key) data field in the multi user mode and data gets updated. But when running in single user mode it is working fine.

Here is my model file.

 asset Product identified by productId{
     o String productId
     o String productTitle
     --> SubSupplier subSupplier optional
     --> Supplier supplier optional
}

Parameters passed: enter image description here

Result : enter image description here

docker ps: enter image description here

Upvotes: 0

Views: 90

Answers (1)

R Thatcher
R Thatcher

Reputation: 5570

I have just tested a simple version of your model (without the relationship fields) and I am getting the same behaviour with single-user and multi-user on the REST server.

asset P2 identified by productId {
  o String productId
  o String productTitle
}

I'm using the latest Composer v0.20.0 and Fabric 1.2

If I include the productId in the JSON:

{
  "$class": "org.fabric.vendor.P2",
  "productId": "11",
  "productTitle": "thirteen"
}

It fails on both single and multi-user modes with the same error: Unhandled error for request PUT /api/P2/11: Error: id property (productId) cannot be updated from 11 to 11

When I remove the product Id:

{
  "$class": "org.fabric.vendor.P2",
  "productTitle": "thirteen"
}

It works fine for both single and multi-user.

I think the error you are seeing is likely to be due to some old data you have on the Fabric before the model was changed. You could try and create some new test data with completely different productIds and values and it may work, but I would suggest starting with a clean Fabric and new Business Network with a simpler model and re-test.

Upvotes: 1

Related Questions