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

Add Google Cloud Storage publisher #1751

Closed
3 tasks done
mahnunchik opened this issue Jun 9, 2020 · 11 comments
Closed
3 tasks done

Add Google Cloud Storage publisher #1751

mahnunchik opened this issue Jun 9, 2020 · 11 comments

Comments

@mahnunchik
Copy link
Contributor

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem Description

It is impossible to use @electron-forge/publisher-s3 with Google Cloud Storage. Documentation: https://cloud.google.com/storage/docs/interoperability

An unhandled error has occurred inside Forge:
Invalid argument.
InvalidArgument: Invalid argument.
{
  Code: 'InvalidArgument',
  Message: 'Invalid argument.',
  Details: 'POST object expects Content-Type multipart/form-data'
}

Proposed Solution

I think it is possible to make @electron-forge/publisher-s3 compatible with Google Cloud Storage.

Alternatives Considered

GCS publisher.

Additional Information

"publishers": [
        {
          "name": "@electron-forge/publisher-s3",
          "config": {
            "bucket": "my-backet",
            "endpoint": "https://storage.googleapis.com",
            "public": false
          }
        }
      ]
@malept
Copy link
Member

malept commented Jun 9, 2020

I will be happy to review a pull request to add this functionality! You'd have to research whether aws-sdk's S3 client allows you to specify the Content-Type header somewhere, and make sure that the change still works with AWS S3 itself.

@mahnunchik
Copy link
Contributor Author

@malept another approach is to upload files with PUT request as google recommended.

@malept
Copy link
Member

malept commented Jun 9, 2020

@mahnunchik it already uses PUT.

@mahnunchik
Copy link
Contributor Author

@malept it is really strange, google say Details: 'POST object expects Content-Type multipart/form-data'

I was able to upload file with PUT request.

@mahnunchik
Copy link
Contributor Author

@malept it uses POST

Original response from error handler:

Response {
  request: Request {
    domain: null,
    service: Service {
      config: [Config],
      endpoint: [Endpoint],
      _events: [Object],
      MONITOR_EVENTS_BUBBLE: [Function: EVENTS_BUBBLE],
      CALL_EVENTS_BUBBLE: [Function: CALL_EVENTS_BUBBLE],
      _clientId: 2
    },
    operation: 'createMultipartUpload',
    params: {
      Bucket: 'my-bucket',
      Key: '1.0.1/App-darwin-x64-1.0.1.zip',
      ACL: 'private'
    },
    httpRequest: HttpRequest {
      method: 'POST',
      path: '/1.0.1/App-darwin-x64-1.0.1.zip?uploads',
      headers: [Object],
      body: '',
      endpoint: [Endpoint],
      region: 'us-east-1',
      _userAgent: 'aws-sdk-nodejs/2.692.0 darwin/v12.16.2',
      virtualHostedBucket: 'my-bucketi',
      stream: [ClientRequest]
    },
    startTime: 2020-06-09T15:24:50.048Z,
    response:...

@malept
Copy link
Member

malept commented Jun 9, 2020

I'm going off of the AWS SDK docs:

Key — (String)

Object key for which the PUT operation was initiated.

Perhaps s3.upload decides to make it a POST because it's a multi-part upload (i.e., too large). There's no logic in the S3 Publisher to determine PUT vs POST.

At any rate, the first link is what we use to upload artifacts using the S3 API.

@mahnunchik
Copy link
Contributor Author

@malept Yep, documentation of AWS SDK says it uses PUT but not in this case...

I may confirm: uploaded file was small (manifest).

@malept
Copy link
Member

malept commented Jun 9, 2020

You might have to figure out how to change aws-sdk to emit the correct Content-Type header, then.

mahnunchik added a commit to mahnunchik/electron-forge that referenced this issue Jun 9, 2020
Implemented Google Cloud Storage publisher (GCS)

ISSUES CLOSED: electron#1751
@mahnunchik
Copy link
Contributor Author

@malept it is too weird to make aws-sdk to works with Google, so I've implemented publisher based on official Google library. Could you please have a look #1752

@malept malept changed the title Make S3 published to be Google Cloud Storage compatible Add Google Cloud Storage publisher Jun 10, 2020
mahnunchik added a commit to mahnunchik/electron-forge that referenced this issue Dec 18, 2020
Implemented Google Cloud Storage publisher (GCS)

ISSUES CLOSED: electron#1751
@maccman
Copy link

maccman commented Feb 17, 2021

This would be cool to get merged.

@mahnunchik
Copy link
Contributor Author

Ping #2100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants