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

Incorrect return value of bulkPurgeTag #7

Closed
dios-david opened this issue Apr 25, 2022 · 3 comments
Closed

Incorrect return value of bulkPurgeTag #7

dios-david opened this issue Apr 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@dios-david
Copy link

dios-david commented Apr 25, 2022

Version

Using 3.0.0-beta3

What happened

I tried to purge multiple surrogate keys in one go, and I found a method called bulkPurgeTag which supposed to do exactly that.
The documentation is little bit unclear for me, as it suggests to pass in the surrogate keys in a field called purge_response 🤔 I did this:

const Fastly = require('fastly');

const FASTLY_SERVICE_ID = '...';
const FASTLY_API_TOKEN = '...';

Fastly.ApiClient.instance.authenticate(FASTLY_API_TOKEN);

const apiInstance = new Fastly.PurgeApi();

const response = await apiInstance.bulkPurgeTag({
  service_id: FASTLY_SERVICE_ID,
  fastly_soft_purge: 0,
  purge_response: {
    surrogate_keys: ['test_key_1', 'test_key_2']
  },
});

console.log(response);

Which look to be working fine, but the response looks like this:

{
  '0': '{',
  '1': ' ',
  '2': '"',
  '3': 'p',
  '4': 'a',
  '5': 't',
  '6': 'h',
  '7': ':',
  '8': 't',
  '9': 'e',
  '10': 's',
  '11': 't',
  '12': '_',
  '13': 'k',
  '14': 'e',
  '15': 'y',
  '16': '_',
  '17': '1',
  '18': '"',
  '19': ':',
  '20': ' ',
  '21': '"',
  '22': '4',
  '23': '2',
  '24': '6',
  '25': '9',
  '26': '-',
  '27': '1',
  '28': '6',
  '29': '5',
  '30': '0',
  '31': '4',
  '32': '6',
  '33': '5',
  '34': '6',
  '35': '8',
  '36': '2',
  '37': '-',
  '38': '3',
  '39': '8',
  '40': '5',
  '41': '7',
  '42': '1',
  '43': '"',
  '44': ',',
  '45': ' ',
  '46': '"',
  '47': 'p',
  '48': 'a',
  '49': 't',
  '50': 'h',
  '51': ':',
  '52': 't',
  '53': 'e',
  '54': 's',
  '55': 't',
  '56': '_',
  '57': 'k',
  '58': 'e',
  '59': 'y',
  '60': '_',
  '61': '2',
  '62': '"',
  '63': ':',
  '64': ' ',
  '65': '"',
  '66': '4',
  '67': '2',
  '68': '6',
  '69': '9',
  '70': '-',
  '71': '1',
  '72': '6',
  '73': '5',
  '74': '0',
  '75': '4',
  '76': '6',
  '77': '5',
  '78': '6',
  '79': '8',
  '80': '2',
  '81': '-',
  '82': '3',
  '83': '8',
  '84': '5',
  '85': '7',
  '86': '2',
  '87': '"',
  '88': ' ',
  '89': '}'
}

Which looks like the character array of the stringified purge response.

@docwilco
Copy link

docwilco commented Feb 8, 2023

Can confirm this is still an issue with 3.1.0

@Integralist
Copy link
Contributor

👋🏻

I believe this issue was fixed in the v4.1.1 release.

Feel free to re-open this issue if you're still having problems.

@zhiln
Copy link

zhiln commented May 14, 2024

still having the issue on v7.1.0 @Integralist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants