Skip to content

[BUG] NodeJS create build from-archive #56

Description

@mariokleinbase

Bug Description

Following the documented request for POST /api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/builds/from-archive does not work. The API reference shows the request as
application/json with archive as a string, but the server rejects that request with a 422 validation error stating that archive "must be a file". No variation of the request we
tried was able to create a build.

Steps to Reproduce

  1. Create a project archive as instructed in the docs:
    zip -r archive.zip . --exclude "node_modules/*" --exclude "dist/*"

  2. Attempt A — request exactly as documented (application/json, archive as a string):
    curl -i "https://developers.hostinger.com/api/hosting/v1/accounts//websites//nodejs/builds/from-archive"
    --request POST
    --header 'Content-Type: application/json'
    --header 'Authorization: Bearer '
    --data '{"archive":"archive.zip","node_version":22,"app_type":"nest","package_manager":"yarn"}'
    422 (see Error Messages): archive "must be a file".

  3. Attempt B — archive as a base64 string in the same application/json body:
    422 with the same must be a file error, plus "must not be greater than 51200 characters".

  4. Attempt C — multipart/form-data (file sent as archive):
    curl -i "https://developers.hostinger.com/api/hosting/v1/accounts//websites//nodejs/builds/from-archive"
    --request POST
    --header 'Authorization: Bearer '
    -F "archive=@archive.zip;type=application/zip"
    -F "node_version=22" -F "app_type=nest" -F "package_manager=yarn"
    403, blocked by a Cloudflare managed challenge before reaching the API. The application/json requests (Attempts A/B) are not challenged; only the multipart/form-data request is.

Expected Behavior

The documented application/json request should be accepted and return a build uuid.

Actual Behavior

  • Attempt A (documented application/json, archive as string): 422 Unprocessable Entityarchive "must be a file".
  • Attempt B (application/json, archive as base64 string): 422 — same error plus a 51200 characters limit.
  • Attempt C (multipart/form-data): 403 — Cloudflare managed challenge, request never reaches the API.

Error Messages / Stack Trace

Attempt A/B response (application/json):

{
  "errors": {
 "archive": [
   "The archive field must be a file.",
   "The archive field must not be greater than 51200 characters.",
   "The archive field must be a file of type: zip, gz, tgz."
 ]
  }
}

Attempt C response (multipart/form-data): HTTP/2 403, Cloudflare managed challenge
cf-mitigated: challenge
server: cloudflare
cf-ray: a1e3b3423bbac76b-IAD
<title>Just a moment...</title>

Additional Context

- The response bodies above are the only responses we received; we could not get any request to return a successful build.
- The Cloudflare challenge occurred only on the multipart/form-data attempt (Attempt C); the application/json attempts (A/B) reached the API and returned the 422.
- Cloudflare block reference for the 403: cf-ray: a1e3b3423bbac76b.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions