Skip to content

Issue calling the unitofwork endpoint: "body must have required property 'data'" #3

@gmodica

Description

@gmodica

When following the Getting Started guide, in the step where we call the Heroku API from APEX, when we execute the unitofwork call we get the following error:

InvokeHerokuAPI.postUnitOfWork();

FAILED!: 400 {"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"body must have required property 'data'"}

The problem is that the index.js that handles the route for unitofwork is expecting the payload to have a "data" node:

Image

However, the api-spec.yaml does not specify the same payload format:

Image

Since dynamic Apex classes are based on the api-spec.yaml definition, there's no "data" attribute on the HerokuAPI_UnitOfWork_IN_body class.

Either the api-spec.yaml or the route logic in index.js needs to be modified to use the same payload definition. I suspect that it would be easier to modify the logic in index.js since all other modifications would require changing the Apex code in the Getting Started guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions