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

The job fails when specifying port number, parameters and query strings. #69

Closed
geosp opened this issue Feb 18, 2020 · 0 comments · Fixed by #70
Closed

The job fails when specifying port number, parameters and query strings. #69

geosp opened this issue Feb 18, 2020 · 0 comments · Fixed by #70

Comments

@geosp
Copy link
Collaborator

geosp commented Feb 18, 2020

I experienced several job failures when specifying a port number, param values and query parameters.
Here is an snipped of code that exemplifies the issue:

let scheduleEvent = async ({ sourceID, frequency, path }) => {
  let {
    scheduler: { uri, port, agendaURI },
  } = config
  if (_.size(frequency)) {
    try {
      // Delete event if it exists.
      await httpClient.delete(`${agendaURI}api/job/${sourceID}`)
    } catch {}
    let payload = {
      name: sourceID,
      // interval: `${_.join(',', frequency)} * * * *`,
      interval: 'three minutes',
      data: {
        body: { scriptPath: `${path}/main.py` },
        // headers: { 'X-Nothing-None': 'NoNoNoNoNo' },
        // params: { id: 24, name: 'donkey' },
        // query: { foo: 'bar', baz: 'qux' },
      },
    }
    await httpClient.post(`${agendaURI}api/job`, {
      body: {
        name: sourceID,
        // url: `${uri}:${port}/launch/:name/:id`,
        url: `${uri}:${port}/launch`,
      },
      json: true,
    })
    await httpClient.post(`${agendaURI}api/job/every`, {
      body: payload,
      json: true,
    })
  }
}

Here is the agenda job JSON that shows the error message:

{
    "_id" : ObjectId("5e4b43cbe7137fe09a0a6bff"),
    "name" : "be51bb3af103899306432b9f156a6c5a",
    "type" : "single",
    "data" : {
        "body" : {
            "scriptPath" : "test/data/bids/us/fl/myflorida/main.py"
        }
    },
    "lastModifiedBy" : null,
    "nextRunAt" : ISODate("2020-02-18T01:57:22.096Z"),
    "priority" : 0,
    "repeatInterval" : "three minutes",
    "repeatTimezone" : null,
    "lockedAt" : null,
    "lastRunAt" : ISODate("2020-02-18T01:54:22.096Z"),
    "failCount" : 1,
    "failReason" : "Cannot destructure property 'keys' of 'obj' as it is undefined.",
    "failedAt" : ISODate("2020-02-18T01:54:22.097Z"),
    "lastFinishedAt" : ISODate("2020-02-18T01:54:22.097Z")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant