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

The getAllCustomResources() function is generating a malformed URL request #60

Closed
bouessay opened this issue May 4, 2020 · 3 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@bouessay
Copy link

bouessay commented May 4, 2020

See: https://jira.corp.adobe.com/browse/AIOE-109

Expected Behaviour

The request should be:
https://%tenantid%-adobeio.campaign.adobe.com/rest/customResource/cusMarketingHistory

Actual Behaviour

The request is:
https://%tenantid%-adobeio.campaign.adobe.com/rest/profileAndServicesExt/cusMarketingHistory

Reproduce Scenario (including but not limited to)

In ACS, create a customRessource without any link (no link to Profiles for instance)
Publish it.

Steps to Reproduce

Create an IO action and try to retrieve all the records of this custom resource, by using this kind of code:
const marketingHistoryRecords =await campaignClient.getAllCustomResources(customResourceName, {})

Platform and Version

@adobe/aio-cli/3.3.0 win32-x64 node-v10.16.0

Sample Code that illustrates the problem

Logs taken while reproducing problem

__secured_getmarketinghistory:ee99b25448a5453799b25448a5853754
2020-05-04T09:12:49.187Z stdout: 2020-05-04T09:12:49.186Z [main /bouessay/marketinghisto-app-0.0.1/__secured_getmarketinghistory] info: Calling the main action
2020-05-04T09:12:49.187Z stdout: 2020-05-04T09:12:49.187Z [main /bouessay/marketinghisto-app-0.0.1/__secured_getmarketinghistory] debug: {"statusCode":200,"body":{"message":"validation success"},"tenant":"intersportfrance-mkt-stage1","__ow_method":"post","apiKey":"0ca1f0006e494d9c8b713a92b82df1a0","LOG_LEVEL":"debug","__ow_headers":{"accept":"/","accept-encoding":"gzip, deflate, br","accept-language":"en-US, en;q=0.5","authorization":"","cache-control":"no-cache","connection":"close","content-type":"application/json","host":"controller-a","origin":"https://localhost:9080","perf-br-req-in":"1588583568.311","pragma":"no-cache","referer":"https://localhost:9080/?_mr=https%3A%2F%2Fexperience.adobe.com%2Fassets%2Fruntime.28bb2226.js&shell_domain=experience.adobe.com","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0","x-forwarded-for":"193.104.215.11, 10.250.204.235","x-forwarded-host":"bouessay.adobeioruntime.net","x-forwarded-port":"443","x-forwarded-proto":"https","x-org-id":"03AA65E45DD69DB50A495C94@AdobeOrg","x-real-ip":"10.250.204.235","x-request-id":"LI1ECmqqDb3BZPXZs7mhhS3alcPPUWh1"},"__ow_path":""}
2020-05-04T09:12:49.213Z stdout: 2020-05-04T09:12:49.213Z [aio-lib-campaign-standard] debug: sdk initialized successfully
2020-05-04T09:12:49.213Z stdout: 2020-05-04T09:12:49.213Z [main /bouessay/marketinghisto-app-0.0.1/__secured_getmarketinghistory] debug: before call getAllCustomResources cusMarketingHistory
2020-05-04T09:12:49.219Z stdout: 2020-05-04T09:12:49.219Z [aio-lib-campaign-standard] debug: REQUEST:
{
"url": "https://mc.adobe.io/intersportfrance-mkt-stage1/campaign/profileAndServicesExt/cusMarketingHistory/",
"credentials": "same-origin",
"headers": {
"X-Api-Key": "0ca1f0006e494d9c8b713a92b82df1a0",
"Authorization": "Bearer [hidden-data]"
},
"method": "GET",
"body": "{}"
}
2020-05-04T09:12:50.360Z stdout: 2020-05-04T09:12:50.360Z [aio-lib-campaign-standard] debug: RESPONSE:
{
"ok": false,
"url": "https://mc.adobe.io/intersportfrance-mkt-stage1/campaign/profileAndServicesExt/cusMarketingHistory/",
"status": 404,
"statusText": "Not Found",
"headers": {
"content-type": "text/plain; charset=utf-8",
"date": "Mon, 04 May 2020 09:12:50 GMT",
"server": "openresty",
"strict-transport-security": "max-age=31536000",
"x-content-type-options": "nosniff",
"x-debug-backend": "https://intersportfrance-mkt-stage1-adobeio.campaign.adobe.com/rest/profileAndServicesExt/cusMarketingHistory/",
"x-request-id": "OaQgC5fhTUfdmEOSD5Yx29MUcqew2UQk",
"x-robots-tag": "noindex",
"x-xss-protection": "1; mode=block",
"content-length": "93",
"connection": "Close"
},
"text": "RST-360011 Une erreur s’est produite. Veuillez contacter l’administrateur.\nError rc=-2003",
"data": "RST-360011 Une erreur s’est produite. Veuillez contacter l’administrateur.\nError rc=-2003",
"body": "RST-360011 Une erreur s’est produite. Veuillez contacter l’administrateur. Error rc=-2003",
"obj": "RST-360011 Une erreur s’est produite. Veuillez contacter l’administrateur. Error rc=-2003"
}
2020-05-04T09:12:50.361Z stdout: 2020-05-04T09:12:50.361Z [main /bouessay/marketinghisto-app-0.0.1/__secured_getmarketinghistory] error: [CampaignStandardSDK:ERROR_GET_ALL_CUSTOM_RESOURCES] 404 - Not Found ("RST-360011 Une erreur s’est produite. Veuillez contacter l’administrateur. Error rc=-2003")
2020-05-04T09:12:50.361Z stdout: 2020-05-04T09:12:50.361Z [main /bouessay/marketinghisto-app-0.0.1/__secured_getmarketinghistory] info: 500: server error

@meryllblanchet meryllblanchet added bug Something isn't working help wanted Extra attention is needed labels May 4, 2020
@meryllblanchet
Copy link
Contributor

Thanks for raising the issue @bouessay !
The fix seems pretty trivial. We will welcome your PR if you want to try and submit it :)

@bouessay bouessay changed the title The getAllCustomResources() function is generated a malformed URL request The getAllCustomResources() function is generating a malformed URL request May 4, 2020
@meryllblanchet
Copy link
Contributor

Actually, we might want to expose both possible endpoints to cover all the scenarios:

  • https://%tenantid%-adobeio.campaign.adobe.com/rest/customResource
  • https://%tenantid%-adobeio.campaign.adobe.com/rest/profileAndServicesExt

Option 1: use the same function with an additional param to configure the endpoint to use
Option 2: expose one function per endpoint

@duynguyen
Copy link
Contributor

Will be fixed by #67 .

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

No branches or pull requests

3 participants