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

Publishing with Electron Forge no longer works #211

Closed
craigwduckett opened this issue Oct 6, 2019 · 15 comments
Closed

Publishing with Electron Forge no longer works #211

craigwduckett opened this issue Oct 6, 2019 · 15 comments
Assignees
Labels

Comments

@craigwduckett
Copy link

Since 1.5.0 publishing via electron forge no longer works. I expect this is due to the new flavor feature and the flavor name included at the end of the file name on upload.

@DustinBrett DustinBrett self-assigned this Oct 6, 2019
@DustinBrett
Copy link
Collaborator

I will look into this asap. Are there any specific errors that you are getting? Also can you clarify where you are seeing flavor name included at the end of the file name on upload?

@DustinBrett
Copy link
Collaborator

DustinBrett commented Oct 6, 2019

The flavor logic was setup with the intention that all the old endpoints could still be used and that flavor would just default to default. So if this is not occurring in this instance I will fix it. All recent changes should be backwards compatible.

Note: All that being said, you will need to migrate the database to accommodate the changes in the models. If this hasn't been done yet then all you need to do is configure the database.json file, which you can base off of database.json.template. Then you just need to run npm run migrate up.

@craigwduckett
Copy link
Author

Doing some investigating now will update soon.

@craigwduckett
Copy link
Author

As a note electron-forge finishes without any errors

@DustinBrett
Copy link
Collaborator

As a note electron-forge finishes without any errors

Okay, good to know. Any errors you are able to generate, please provide so I can narrow down my search for a fix. Thanks.

@craigwduckett
Copy link
Author

craigwduckett commented Oct 6, 2019

Things i've noticed so far

  • No errors from electron forge
  • Electron forge finishes quickly
  • There are POST calls to the server
  • No errors thrown by nginx
  • No new entries in database

@DustinBrett
Copy link
Collaborator

Things i've noticed so far

  • No errors from electron forge
  • Electron forge finishes quickly
  • There are POST calls to the server
  • No errors thrown by nginx
  • No new entries in database

Is there anything coming from the node console where electron release server is running? Have you ran the migration scripts and did they have any issues?

@craigwduckett
Copy link
Author

Yes Migration scripts have been run. I can manually create the version and upload files. Attached image of console from server.

image

@DustinBrett
Copy link
Collaborator

Ok, I will setup electron forge and test this tomorrow.

It will be interesting to see what data it's posting and to what endpoint.

Perhaps I need to add flavor into the provided version object when it's missing during publish, or a beforeCreate on the model and remove required restriction on flavor.

Sorry for the inconvenience, I'll get to the bottom of this error either way. I'm glad manual creation and migration worked for you at least.

@craigwduckett
Copy link
Author

Thanks, not a problem, appreciate all the updates you are doing. I'll keep testing and post updates.

@craigwduckett
Copy link
Author

craigwduckett commented Oct 6, 2019

Using postman I tried to POST a file using data from uploading via the admin page and worked successfully.
image

Trying again but removing the '_default' (I'm guessing this is what electron forge sends) from the version errors.

{
  "invalidAttributes": {
    "name": [
      {
        "rule": "string",
        "message": "Value should be a string (instead of null, which is an object)"
      },
      {
        "rule": "required",
        "message": "\"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined"
      }
    ],
    "channel": [
      {
        "rule": "required",
        "message": "\"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined"
      }
    ],
    "availability": [
      {
        "rule": "datetime",
        "message": "Value should be a datetime (instead of null, which is an object)"
      },
      {
        "rule": "required",
        "message": "\"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined"
      }
    ],
    "flavor": [
      {
        "rule": "required",
        "message": "\"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined"
      }
    ]
  },
  "model": "Version",
  "_e": {},
  "rawStack": "    at WLValidationError.WLError (/var/www/node_modules/waterline/lib/waterline/error/WLError.js:25:15)\n    at new WLValidationError (/var/www/node_modules/waterline/lib/waterline/error/WLValidationError.js:19:28)\n    at _afterValidating (/var/www/node_modules/waterline/lib/waterline/query/validate.js:53:23)\n    at allValidationsChecked (/var/www/node_modules/waterline/lib/waterline/core/validations.js:265:12)\n    at /var/www/node_modules/waterline/node_modules/async/lib/async.js:52:16\n    at Object.async.forEachOf.async.eachOf (/var/www/node_modules/waterline/node_modules/async/lib/async.js:236:30)\n    at Object.async.forEach.async.each (/var/www/node_modules/waterline/node_modules/async/lib/async.js:209:22)\n    at module.exports.Validator.validate (/var/www/node_modules/waterline/lib/waterline/core/validations.js:144:9)\n    at /var/www/node_modules/waterline/lib/waterline/query/validate.js:42:25\n    at /var/www/node_modules/waterline/node_modules/async/lib/async.js:718:13\n    at Immediate.iterate [as _onImmediate] (/var/www/node_modules/waterline/node_modules/async/lib/async.js:262:13)\n    at runCallback (timers.js:705:18)\n    at tryOnImmediate (timers.js:676:5)\n    at processImmediate (timers.js:658:5)\n    at process.topLevelDomainCallback (domain.js:126:23)",
  "reason": "4 attributes are invalid",
  "code": "E_VALIDATION",
  "status": 400,
  "details": "Invalid attributes sent to Version:\n • name\n   • Value should be a string (instead of null, which is an object)\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • channel\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • availability\n   • Value should be a datetime (instead of null, which is an object)\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • flavor\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n",
  "message": "[Error (E_VALIDATION) 4 attributes are invalid] Invalid attributes sent to Version:\n • name\n   • Value should be a string (instead of null, which is an object)\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • channel\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • availability\n   • Value should be a datetime (instead of null, which is an object)\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n • flavor\n   • \"required\" validation rule failed for input: null\nSpecifically, it threw an error.  Details:\n undefined\n",
  "stack": "Error (E_VALIDATION) :: 4 attributes are invalid\n    at WLValidationError.WLError (/var/www/node_modules/waterline/lib/waterline/error/WLError.js:25:15)\n    at new WLValidationError (/var/www/node_modules/waterline/lib/waterline/error/WLValidationError.js:19:28)\n    at _afterValidating (/var/www/node_modules/waterline/lib/waterline/query/validate.js:53:23)\n    at allValidationsChecked (/var/www/node_modules/waterline/lib/waterline/core/validations.js:265:12)\n    at /var/www/node_modules/waterline/node_modules/async/lib/async.js:52:16\n    at Object.async.forEachOf.async.eachOf (/var/www/node_modules/waterline/node_modules/async/lib/async.js:236:30)\n    at Object.async.forEach.async.each (/var/www/node_modules/waterline/node_modules/async/lib/async.js:209:22)\n    at module.exports.Validator.validate (/var/www/node_modules/waterline/lib/waterline/core/validations.js:144:9)\n    at /var/www/node_modules/waterline/lib/waterline/query/validate.js:42:25\n    at /var/www/node_modules/waterline/node_modules/async/lib/async.js:718:13\n    at Immediate.iterate [as _onImmediate] (/var/www/node_modules/waterline/node_modules/async/lib/async.js:262:13)\n    at runCallback (timers.js:705:18)\n    at tryOnImmediate (timers.js:676:5)\n    at processImmediate (timers.js:658:5)\n    at process.topLevelDomainCallback (domain.js:126:23)"
}

@ArekSredzki ArekSredzki added the bug label Oct 7, 2019
@DustinBrett
Copy link
Collaborator

I've created a PR to deal with this issue hopefully.

I setup Electron Forge and there were indeed some issues with publishing. It doesn't provide availability or flavor and it shouldn't have to, so I have adjusted those requirements in the Version model. Then when it goes to add the asset it tries to use the version name and not the id, so I have added a check when creating assets to handle this case of version not including flavor. In my tests this allowed publishing to work via Electron Forge.

@craigwduckett
Copy link
Author

Great thanks @DustinBrett will test once merged

@ArekSredzki
Copy link
Owner

It has merged :)

@craigwduckett
Copy link
Author

Working perfectly, cheers team.

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

3 participants