repman icon indicating copy to clipboard operation
repman copied to clipboard

404 while fetch my private package

Open julienbonvarlet opened this issue 11 months ago • 13 comments

Hello !

I get some 404 errors while fetching my private packages:

Using HTTP basic authentication with username "token"
Downloading https://faume-co.repo.repman.io/packages.json
[200] https://faume-co.repo.repman.io/packages.json
Writing /Users/tyloo/Library/Caches/composer/repo/https---faume-co.repo.repman.io/packages.json into cache
Downloading https://faume-co.repo.repman.io/p2/faume/php.json
Downloading https://faume-co.repo.repman.io/p2/faume/shipping-bundle.json
[404] https://faume-co.repo.repman.io/p2/faume/php.json
[404] https://faume-co.repo.repman.io/p2/faume/shipping-bundle.json

Do you guys have any idea how to fix this please ? Thanks !

julienbonvarlet avatar Mar 01 '24 10:03 julienbonvarlet

I have the same problem

LBos-PH avatar Mar 01 '24 10:03 LBos-PH

Same isssue what's going on?

anthonyvancauwenberghe avatar Mar 01 '24 17:03 anthonyvancauwenberghe

Only a workaround: A manual click on "Update" in the package solves the problem for individual packages.

gerdemann avatar Mar 04 '24 09:03 gerdemann

Only a workaround: A manual click on "Update" in the package solves the problem for individual packages.

Thanks, this solved it for us.

Sfonxs avatar Mar 04 '24 11:03 Sfonxs

Same issue here. We have like a 100 packages though. Any fixes from repman's part?

SteJW avatar Mar 05 '24 16:03 SteJW

Made a small (ugly) script to automate. If you get the json with all your packages from https://repman.io/docs/api/, you can use this to update everything at once.

` $decoded = json_decode($json, true); foreach($decoded['data'] as $package) { $curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.repman.io/api/organization/###org_name###/package/' . $package['id'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => array(
    'X-API-TOKEN: ###YOUR API KEY###'
),
));

$response = curl_exec($curl);
var_dump($response, $package['id']);
curl_close($curl);

}`

SteJW avatar Mar 05 '24 16:03 SteJW

I have extended the script a little. Only the API token and the organisation need to be entered at the top.

<?php
$apiToken = '### MY API TOKEN ###';
$organisation = 'MyOrganisationName';

$apiURLBase = 'https://app.repman.io/api/organization/' . $organisation . '/package';
$allData = [];
$page = 1;
do {
    $curl = curl_init();

    curl_setopt_array(
        $curl,
        [
            CURLOPT_URL => $apiURLBase . '?page=' . $page,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_HTTPHEADER => [
                'accept: application/json',
                'X-API-TOKEN: ' . $apiToken
            ],
        ]
);

    $response = curl_exec($curl);

    if (curl_errno($curl)) {
        echo "cURL error: " . curl_error($curl) . "\n";
        exit(1);
    }

    $decodedResponse = json_decode($response, true);

    curl_close($curl);

    if (!empty($decodedResponse['data'])) {
        $allData = array_merge($allData, $decodedResponse['data']);
    }

    $nextPageUrl = $decodedResponse['links']['next'] ?? null;
    $page++;
} while ($nextPageUrl !== null);

foreach ($allData as $package) {
    $curl = curl_init();

    curl_setopt_array(
        $curl,
        [
            CURLOPT_URL => 'https://app.repman.io/api/organization/' . $organisation . '/package/' . $package['id'],
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => 'PUT',
            CURLOPT_HTTPHEADER => [
                'X-API-TOKEN: ' . $apiToken
            ],
        ]
    );

    $response = curl_exec($curl);
    curl_close($curl);
    
    echo 'Updated package: ' . $package['name'] . PHP_EOL;
}
echo '---------------------------' . PHP_EOL;
echo 'done' . PHP_EOL;

Put this in an update.php file and call it up like this:

php update.php

gerdemann avatar Mar 12 '24 07:03 gerdemann

@gerdemann thanks for the script, I tried it but none of my packages are getting updated - seems like updating one by one doesn't work anymore, I tried it form the GUI and still couldn't get any package to update

treestonemedia avatar Mar 12 '24 14:03 treestonemedia

FWIW I use this script and works 100% (always) for me:

https://gist.github.com/ProxiBlue/f00ecb42c1eade71c8c0f991da6d13f0

ProxiBlue avatar Mar 12 '24 15:03 ProxiBlue

Hello. If you still experience issues, please contact us at [email protected] and send us the URL of the package and its version.

adaluppa avatar Mar 13 '24 10:03 adaluppa

Hello @adaluppa , all packages are now working fine

treestonemedia avatar Mar 13 '24 13:03 treestonemedia

This is an ongoing problem and has been for years. Something with the shared version results in sync backlogs and invalid caches. You have to manually re-sync the libraries from time to time.

I provided a script a while back to do this https://github.com/repman-io/repman/issues/568#issuecomment-1071996304

Long term solution is likely to host your own copy of repman.

swichers avatar Mar 14 '24 23:03 swichers

Having the problem again.

Are there any information what's causing the issue from time to time?

core23 avatar Mar 28 '24 10:03 core23