getmeli / meli

Platform for deploying static sites and frontend applications easily. Automatic SSL, deploy previews, reverse proxy, and more.
Other
2.41k stars 97 forks source link

Error: Request body larger than maxBodyLength limit #187

Closed damyo closed 3 years ago

damyo commented 3 years ago

I tried to upload the site through GitHub Actions, but it fails with an error. This error occurs during the publish phase and everything else goes well.

✅ Set up job ✅ Run actions ✅ checkout@v2 ✅ Run actions ✅ setup-node@v1 ❌ publish ✅ Post Run actions/checkout@v2 ✅ Complete Job

From what I have looked at, it is already defined as maxBodyLength: Infinity in the meli-cli/src/commons/axios/axios.ts file, so I don't know which part is the problem. And there doesn't seem to be an option available for maxBodyLength other than token, site, url, directory, release, branch, so am I missing something?

Please refer to my failure log.

Run npx @getmeli/cli@next upload \
npx: installed 84 in 4.616s

 Meli CLI v1.0.0-next.4 - 2020-12-04T16:24:43.261Z - dfa044bbd899b53cfe0d965c077c88ad2779577c

fv-az281-686 2543 2021-01-15T12:20:36.369Z info  meli.cli:upload Compressing files from ./.... 
fv-az281-686 2543 2021-01-15T12:20:39.484Z info  meli.cli:upload Uploading release to https://xxx.yyy.zzz... 
Error: r]: Request body larger than maxBodyLength limit
    at /home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:1911
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Object.t.uploadArchive (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:6541)
    at Object.t.upload (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:4281) {
  error: Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
      at RedirectableRequest.write (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/follow-redirects/index.js:96:24)
      at FormData.ondata (internal/streams/legacy.js:19:31)
      at FormData.emit (events.js:314:20)
      at FormData.CombinedStream.write (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/combined-stream/lib/combined_stream.js:138:8)
      at DelayedStream.ondata (internal/streams/legacy.js:19:31)
      at DelayedStream.emit (events.js:314:20)
      at DelayedStream._handleEmit (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/delayed-stream/lib/delayed_stream.js:82:15)
      at ReadStream.source.emit (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/delayed-stream/lib/delayed_stream.js:29:19)
      at addChunk (_stream_readable.js:297:12)
      at readableAddChunk (_stream_readable.js:272:9)
  Error: Thrown at:
      at /home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:1807
      at Object.t.uploadArchive (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:6541)
      at Object.t.upload (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:4281) {
    config: {
      url: 'https://xxx.yyy.zzz/api/v1/sites/$Site_ID/releases',
      method: 'post',
      data: [FormData],
      headers: [Object],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      adapter: [Function: httpAdapter],
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      validateStatus: [Function: validateStatus],
      errorContext: Error: Thrown at:
          at /home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:1807
          at Object.t.uploadArchive (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:6541)
          at Object.t.upload (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:4281)
    },
    request: Writable {
      _writableState: [WritableState],
      writable: true,
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _ended: false,
      _ending: false,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 10420464,
      _requestBodyBuffers: [Array],
      _onNativeResponse: [Function],
      _currentRequest: [ClientRequest],
      _currentUrl: 'https://xxx.yyy.zzz/api/v1/sites/$Site_ID/releases',
      [Symbol(kCapture)]: false
    },
    response: undefined,
    isAxiosError: true,
    toJSON: [Function: toJSON]
  }
}
{
  "errorObject": {
    "message": "Request body larger than maxBodyLength limit",
    "name": "Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]",
    "stack": "Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit\n    at RedirectableRequest.write (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/follow-redirects/index.js:96:24)\n    at FormData.ondata (internal/streams/legacy.js:19:31)\n    at FormData.emit (events.js:314:20)\n    at FormData.CombinedStream.write (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/combined-stream/lib/combined_stream.js:138:8)\n    at DelayedStream.ondata (internal/streams/legacy.js:19:31)\n    at DelayedStream.emit (events.js:314:20)\n    at DelayedStream._handleEmit (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/delayed-stream/lib/delayed_stream.js:82:15)\n    at ReadStream.source.emit (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/node_modules/delayed-stream/lib/delayed_stream.js:29:19)\n    at addChunk (_stream_readable.js:297:12)\n    at readableAddChunk (_stream_readable.js:272:9)\nError: Thrown at:\n    at /home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:1807\n    at Object.t.uploadArchive (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:6541)\n    at Object.t.upload (/home/runner/.npm/_npx/2543/lib/node_modules/@getmeli/cli/build/index.js:2:4281)",
    "config": {
      "url": "https://xxx.yyy.zzz/api/v1/sites/$Site_ID/releases",
      "method": "post",
      "data": {
        "_overheadLength": 455,
        "_valueLength": 47,
        "_valuesToMeasure": [
          {
            "_readableState": {
              "objectMode": false,
              "highWaterMark": 65536,
              "buffer": {
                "head": null,
                "tail": null,
                "length": 0
              },
              "length": 0,
              "pipes": null,
              "pipesCount": 0,
              "flowing": true,
              "ended": false,
              "endEmitted": false,
              "reading": true,
              "sync": false,
              "needReadable": true,
              "emittedReadable": false,
              "readableListening": false,
              "resumeScheduled": false,
              "emitClose": false,
              "autoDestroy": false,
              "destroyed": false,
              "defaultEncoding": "utf8",
              "awaitDrainWriters": null,
              "multiAwaitDrain": false,
              "readingMore": false,
              "decoder": null,
              "encoding": null
            },
            "readable": true,
            "_events": {},
            "_eventsCount": 3,
            "path": "/tmp/$Site_ID-ccde4f0c22904be8dc984f6b2004266bd01625be-undefined.tar.gz",
            "fd": 21,
            "flags": "r",
            "mode": 438,
            "end": null,
            "autoClose": true,
            "bytesRead": 10485760,
            "closed": false
          }
        ],
        "writable": true,
        "readable": true,
        "dataSize": 0,
        "maxDataSize": 2097152,
        "pauseStreams": true,
        "_released": true,
        "_streams": [
          null,
          "----------------------------036290788713385731011627\r\nContent-Disposition: form-data; name=\"release\"\r\n\r\n",
          "ccde4f0c22904be8dc984f6b2004266bd01625be",
          null,
          "----------------------------036290788713385731011627\r\nContent-Disposition: form-data; name=\"branches\"\r\n\r\n",
          "develop",
          null
        ],
        "_currentStream": {
          "source": {
            "_readableState": {
              "objectMode": false,
              "highWaterMark": 65536,
              "buffer": {
                "head": null,
                "tail": null,
                "length": 0
              },
              "length": 0,
              "pipes": null,
              "pipesCount": 0,
              "flowing": true,
              "ended": false,
              "endEmitted": false,
              "reading": true,
              "sync": false,
              "needReadable": true,
              "emittedReadable": false,
              "readableListening": false,
              "resumeScheduled": false,
              "emitClose": false,
              "autoDestroy": false,
              "destroyed": false,
              "defaultEncoding": "utf8",
              "awaitDrainWriters": null,
              "multiAwaitDrain": false,
              "readingMore": false,
              "decoder": null,
              "encoding": null
            },
            "readable": true,
            "_events": {},
            "_eventsCount": 3,
            "path": "/tmp/$Site_ID-ccde4f0c22904be8dc984f6b2004266bd01625be-undefined.tar.gz",
            "fd": 21,
            "flags": "r",
            "mode": 438,
            "end": null,
            "autoClose": true,
            "bytesRead": 10485760,
            "closed": false
          },
          "dataSize": 0,
          "maxDataSize": null,
          "pauseStream": true,
          "_maxDataSizeExceeded": false,
          "_released": true,
          "_bufferedEvents": [],
          "_events": {
            "error": [
              null,
              null
            ],
            "end": [
              null,
              null
            ]
          },
          "_eventsCount": 4
        },
        "_insideLoop": false,
        "_pendingNext": false,
        "_boundary": "--------------------------036290788713385731011627",
        "_events": {
          "error": [
            null,
            null
          ]
        },
        "_eventsCount": 3
      },
      "headers": {
        "Accept": "application/json, text/plain, */*",
        "Content-Type": "multipart/form-data; boundary=--------------------------036290788713385731011627",
        "x-meli-token": "$Token",
        "User-Agent": "axios/0.21.1"
      },
      "transformRequest": [
        null
      ],
      "transformResponse": [
        null
      ],
      "timeout": 0,
      "xsrfCookieName": "XSRF-TOKEN",
      "xsrfHeaderName": "X-XSRF-TOKEN",
      "maxContentLength": -1,
      "maxBodyLength": -1,
      "errorContext": {}
    },
    "code": "ERR_FR_MAX_BODY_LENGTH_EXCEEDED"
  },
  "response": {}
}
Error: Process completed with exit code 1.
pimartin commented 3 years ago

@damyo It appears you are using an old version of the CLI. Could you please try with the latest version (1.1.2) ?

I successfully uploaded a 405MB archive while testing with the latest version.

damyo commented 3 years ago

@pimartin You were right. In the guide document, it was written as npx @getmeli/cli@next upload, but it was solved by modifying this to npx @getmeli/cli@latest upload. Thanks. But right away I ran into a new problem... :(

fv-az32-67 2517 2021-01-17T16:02:32.467Z info  meli.cli:upload Uploading release to https://xxx.yyy.zzz... 
Error: r]: write EPROTO 139829632739200:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

This is the setting of my GitHub Actions.

name: main
on: [ push ]
env:
  MELI_SITE: "xxx"
jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '12'
      - name: "publish"
        run: |
          npx @getmeli/cli@latest upload \
            --url "https://xxx.yyy.zzz" \
            --site "$MELI_SITE" \
            --token "$MELI_TOKEN" \
            --release "$GITHUB_SHA" \
            ./
        env:
          MELI_TOKEN: "xxx"

And this is my Advanced DNS settings. https://imgur.com/ApBx8B2

If you have any idea, please let me know. It may feel difficult because I lack experience, but I want the document to be more detailed and kind.

gempain commented 3 years ago

@damyo I just saw that in "how to upload a site" Github Actions section that the example still used @next, that was misleading, thanks for pointing this out !

Regarding the SSL problem, this is really strange, I'll take a look at get back to you. Don't worry, we're here to help the best we can.

damyo commented 3 years ago

@gempain There is one more thing I'd like to check out about the errors in the guide.

- name: "build"
        run |
          npm ci
          npm run build

I think the : is missing after the run, right? Thanks for actively helping me.

gempain commented 3 years ago

@damyo

@gempain There is one more thing I'd like to check out about the errors in the guide.

- name: "build"
        run |
          npm ci
          npm run build

I think the : is missing after the run, right? Thanks for actively helping me.

Yes, that's a good catch too ! I just pushed a fix 😄 When you see things like this, don't hesitate opening issues or even submitting a pull request in our docs repository as I might not be around to fix it right away 😄

gempain commented 3 years ago

@damyo as far as I can tell, your SSL problem seems to come from different versions of the SSL protocol being used. Your Ubuntu version seems recent, so I don't think that's the issue, but maybe your server is serving Meli with an old SSL version ? Or maybe it's trying to server HTTP under HTTPS ? Honestly, I'm bailing out here, I'm sorry I can't be of any better help to you 😞 !

I'm closing this issue as I think the original title has been resolved, but feel free to open new issues as you go along. We'll be around to help. You may continue to reply, we'll reopen if needed.

pimartin commented 3 years ago

@damyo If the issue doesn't seem to come from your side and you still need help investigating the problem, feel free to create another issue with as much information on your setup as possible, like (reverse) proxies you might be using. I will have another look and see if I can help.

damyo commented 3 years ago

@gempain @pimartin I found the cause of my problem. In the example file on GitHub Actions

       -name: "publish"
         run: |
           npx @getmeli/cli upload \
             --url "https://cloud.meli.sh" \

I thought the --url above was the address I registered in the settings of the site I created in meli. However, it was actually my meli site address, https://meli.my-company.com. The address https://cloud.meli.sh was unfamiliar and difficult to understand what it meant. Anyway, I am very happy that it is finally working properly. It wasn't easy, but it's worth it.

For reference, in my case npx @getmeli/cli upload caused another type of problem. Only npx @getmeli/cli@latest worked fine.

gempain commented 3 years ago

@damyo I am thrilled to know that this had been resolved ! And also, thank you so much for the kind words. I say this often to people, but trust me, when someone shows appreciation of our work, it truly makes us proud and motivates us to bring you the best we can.

Thanks also for providing feedback on the docs. I just pushed a for using meli.my-company.com instead of cloud.meli.sh, I hope it will avoid issues in the future.

Regarding the npx issue, it's really strange because I'm not seeing any issues on my end:

$ npx @getmeli/cli
npx: installed 86 in 7.858s

 Meli CLI v1.1.2 - 2020-12-23T12:53:18.546Z - 2b3ea929c4b0f315f058ed9885669aecbc7b22bf

Unknown command "", see --help

Both @getmeli/cli and @getmeli/cli@latest should basically point to the same thing. If you look on Npm, you'll see that 1.1.2 is the latest version:

Screen Shot 2021-01-19 at 17 31 33

Perhaps your cache is behaving strangely ?