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

POST /works: 500 when provided field not in context #848

Open
lautarodragan opened this issue Jan 31, 2019 · 2 comments
Open

POST /works: 500 when provided field not in context #848

lautarodragan opened this issue Jan 31, 2019 · 2 comments
Labels

Comments

@lautarodragan
Copy link
Member

lautarodragan commented Jan 31, 2019

POST /works
{
  "name": "string",
  "datePublished": "2019-01-31T09:21:54.567Z",
  "dateCreated": "2019-01-31T09:21:54.567Z",
  "author": "string",
  "tags": "string",
  "text": "string"
}

The text field should be content, but it shouldn't return a 500.

{
  "level": 50,
  "time": 0,
  "msg": "api.CreateWork",
  "pid": 25,
  "hostname": "",
  "module": "works",
  "exception": {
    "stack": [
      "Error: The property \"text\" in the input was not defined in the context.",
      "    at options.expansionMap.info (/usr/src/app/api/node_modules/jsonld-signatures/lib/suites/LinkedDataSignature.js:97:17)",
      "    at _expandObject (/usr/src/app/api/node_modules/jsonld/lib/expand.js:356:26)",
      "    at Object.api.expand (/usr/src/app/api/node_modules/jsonld/lib/expand.js:176:3)",
      "    at _expandObject (/usr/src/app/api/node_modules/jsonld/lib/expand.js:620:29)",
      "    at api.expand (/usr/src/app/api/node_modules/jsonld/lib/expand.js:176:3)",
      "    at /usr/src/app/api/node_modules/jsonld/lib/jsonld.js:327:18",
      "    at process._tickCallback (internal/process/next_tick.js:68:7)"
    ],
    "message": "The property \"text\" in the input was not defined in the context.",
    "type": "Error"
  },
  "v": 1
}
@WesleyCharlesBlake
Copy link
Member

The API docs in swagger hub have the correct schema, but I know it used to be text. Possibly wrong implementation by someone sending the text field here. Regardless we could handle this better. Thanks for logging the issue!

@lautarodragan
Copy link
Member Author

Yeah. The underlying issue is incorrect handling of input not matching default schema, which is related to #552.

People are sending text rather than content because the frost-client typings are out of date, victim of copy pasta, tracked in poetapp/frost-client#220.

@lautarodragan lautarodragan added ux and removed bug labels Apr 10, 2019
@lautarodragan lautarodragan added dx Developer Experience and removed ux labels Jun 19, 2019
@lautarodragan lautarodragan changed the title Internal Server Error when sending text POST /works: Internal Server Error when sending field not in context Jun 19, 2019
@lautarodragan lautarodragan changed the title POST /works: Internal Server Error when sending field not in context POST /works: 500 when sending field not in context Jun 19, 2019
@lautarodragan lautarodragan changed the title POST /works: 500 when sending field not in context POST /works: 500 when provided field not in context Jun 19, 2019
@lautarodragan lautarodragan added ux and removed dx Developer Experience labels Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants