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

[BUG]: createOrUpdateFileContents results in error 504 #702

Open
1 task done
jp-bennett opened this issue Dec 11, 2023 · 4 comments
Open
1 task done

[BUG]: createOrUpdateFileContents results in error 504 #702

jp-bennett opened this issue Dec 11, 2023 · 4 comments
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@jp-bennett
Copy link

What happened?

Using the createOrUpdateFileContents in a the pull-request-artifacts action is failing to upload, and returning a 504 error, and the message "Error: We couldn't respond to your request in time. Sorry about that. Please try resubmitting your request and contact us if the problem persists."

Versions

plugin-rest-endpoint-methods 10.1.2

Relevant log output

Run gavv/pull-request-artifacts@v2.1.0
Artifacts repo: meshtastic/artifacts
Artifacts branch: device
Artifacts prefix: "pr2739-"
Processing artifact: ./firmware-2.2.16.d952da8.zip
GET /repos/meshtastic/artifacts/contents/.?ref=device - 200 in 264ms
Uploading file pr2739-firmware-2.2.16.d952da8.zip (first time)
PUT /repos/meshtastic/artifacts/contents/pr2739-firmware-2.2.16.d952da8.zip - 504 in 11150ms
Error: We couldn't respond to your request in time. Sorry about that. Please try resubmitting your request and contact us if the problem persists.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jp-bennett jp-bennett added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Dec 11, 2023
Copy link
Contributor

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@jp-bennett
Copy link
Author

I'm also seeing a 502 error: Uploading file pr2998-firmware-2.2.16.0792274.zip (first time)

22PUT /repos/meshtastic/artifacts/contents/pr2998-firmware-2.2.16.0792274.zip - 502 in 12451ms

23Error: Server Error

@wolfy1339
Copy link
Member

Can you share a code snippet demonstratimg the issue?

@jp-bennett
Copy link
Author

@wolfy1339 Sure. So we're seeing this while using https://github.com/gavv/pull-request-artifacts and an example CI run is at https://github.com/meshtastic/firmware/actions/runs/7185520403/job/19573992603#step:13:24

That code is at https://github.com/gavv/pull-request-artifacts/blob/main/src/main.ts#L147

      file_path: string,
      file_content: Buffer
    ): Promise<string> => {
      const old_sha = await findFileSha(file_path)

      if (old_sha) {
        core.info(`Uploading file ${file_path} (old sha ${old_sha})`)
      } else {
        core.info(`Uploading file ${file_path} (first time)`)
      }

      const repo_url = `https://github.com/${context.repo.owner}/${context.repo.repo}`
      const short_sha = commit_sha.substring(0, 5)

      let message = `Upload ${file_path} (${short_sha})`

      if (inter_link) {
        message += `

Pull request: ${repo_url}/pull/${context.issue.number}
Commit: ${repo_url}/commit/${commit_sha}
`
      }

      await artifacts_octokit.rest.repos.createOrUpdateFileContents({
        owner: artifacts_owner,
        repo: artifacts_repo,
        path: file_path,
        message,
        content: file_content.toString('base64'),
        branch: artifacts_branch,
        sha: old_sha
      })

      const artifacts_repo_url = `https://github.com/${artifacts_owner}/${artifacts_repo}`
      return `${artifacts_repo_url}/blob/${artifacts_branch}/${file_path}?raw=true`
    }```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

2 participants