adobe / aio-lib-customer-profile Goto Github PK
View Code? Open in Web Editor NEWAdobe I/O Javascript SDK wrapping Adobe Experience Platform Real-Time Customer Profile API
Home Page: https://www.adobe.io
License: Apache License 2.0
Adobe I/O Javascript SDK wrapping Adobe Experience Platform Real-Time Customer Profile API
Home Page: https://www.adobe.io
License: Apache License 2.0
βοΈ Important announcement: Greenkeeper will be saying goodbye π and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io
1.1.0
to 1.2.0
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@adobe/eslint-config-aio-lib-config is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 6 commits.
f6a0062
1.2.0
15102de
feat: add plugin:node/recommended to check for extraneous/missing requires (#7)
849c15b
chore(package): update eslint-plugin-jsdoc to version 23.0.0 (#6)
a3788dd
chore(package): update eslint-plugin-jsdoc to version 22.0.0 (#5)
7c2e18e
Update README.md
3a9468d
Update dependencies to enable Greenkeeper π΄ (#4)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
perform a call to experience platform to retrieve a profile
Getting following error
error: [CustomerProfileAPISDK:ERROR_ENTITIES] Error TypeError: Request with GET/HEAD method cannot have body at new Request (/nodejsAction/irV4eJAV/index.js:176020:10) at /nodejsAction/irV4eJAV/index.js:176230:19 at new Promise (<anonymous>) at Object.fetch (/nodejsAction/irV4eJAV/index.js:176228:9) at Object.fetch (/nodejsAction/irV4eJAV/index.js:131569:20) at _callee$ (/nodejsAction/irV4eJAV/index.js:38978:86) at tryCatch (/nodejsAction/irV4eJAV/index.js:183746:40) at Generator.invoke [as _invoke] (/nodejsAction/irV4eJAV/index.js:183976:22) at Generator.next (/nodejsAction/irV4eJAV/index.js:183801:21) at asyncGeneratorStep (/nodejsAction/irV4eJAV/index.js:105437:24)
Run the below code with proper values for parameters and you get the error
CLI plugins: core: @adobe/aio-cli 7.1.0 @adobe/aio-cli-plugin-app 7.0.2 @adobe/aio-cli-plugin-auth 2.4.1 @adobe/aio-cli-plugin-certificate 0.3.0 @adobe/aio-cli-plugin-config 2.3.0 @adobe/aio-cli-plugin-console 3.3.0 @adobe/aio-cli-plugin-events 1.1.5 @adobe/aio-cli-plugin-info 2.0.0 @adobe/aio-cli-plugin-runtime 4.0.0 @oclif/plugin-autocomplete 0.3.0 @oclif/plugin-help 2.2.3 @oclif/plugin-not-found 1.2.4 @oclif/plugin-plugins 1.10.0 @oclif/plugin-warn-if-update-available 1.7.0
using version 1.0.4
// initialize sdk const client = await CustomerProfile.init(params.tenant, params.orgId, params.apiKey, token) // call methods, eg getProfile const profile = await client.getProfile({ entityId: params.entityId, entityIdNS: params.entityIdNS }); const response = { statusCode: 200, body: profile }
Thanks in advance.
Should return a successful response
Throwing Error
Mac OS used
"@adobe/aio-sdk": "^4.1.0"
Node.js v20.5.1
NPM version 9.8.0
const { Core, State, Files, Target, Analytics, CampaignStandard, CustomerProfile, AudienceManagerCD, Events } = require('@adobe/aio-sdk');
async function sdkTest() {
//initialize sdk
const customerProfileClient = await CustomerProfile.init('', '', 'x-api-key', '', '[sandbox]')
// Customer Profile example
const profileParams = {
entityId: 'xyz',
entityIdNS: 'loyaltyId'
}
const customerProfile = await customerProfileClient.getProfile(profileParams)
console.log(customerProfile);
AioCoreSDKError [CustomerProfileAPIError]: [CustomerProfileAPISDK:ERROR_ENTITIES] Error TypeError: Failed to parse URL from /data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=079157043&entityIdNS=loyaltyId
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async http (/Users/xxxx/node/node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:778:13)
at new Request (node:internal/deps/undici/undici:7132:25)
at fetch2 (node:internal/deps/undici/undici:10715:25)
at Object.fetch (node:internal/deps/undici/undici:11574:18)
at fetch (node:internal/process/pre_execution:271:25)
at http (/Users/xxxx/node/node_modules/swagger-client/lib/http/index.js:74:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=079157043&entityIdNS=loyaltyId',
code: 'ERR_INVALID_URL'
}
}
at new (/Users/xxx/node/node_modules/@adobe/aio-lib-core-errors/src/AioCoreSDKErrorWrapper.js:33:9)
at /Users/xxx/node/node_modules/@adobe/aio-lib-customer-profile/src/openApiSDK.js:102:18
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERROR_ENTITIES',
sdk: 'CustomerProfileAPISDK',
sdkDetails: { parameters: { entityId: 'xyz', entityIdNS: 'loyaltyId' } }
}
File .github/workflows/node.js.yml. See https://github.com/adobe/aio-cli-plugin-app/blob/5670908e7ef7ba63c903ee924520eeb018a9e448/.github/workflows/node.js.yml#L32-L36
npm audit issue: https://github.com/swagger-api/swagger-js/releases/tag/v3.13.5
FAIL e2e/e2e.js
β sdk init test (3 ms)
β bad access token (56 ms)
β bad api key (19 ms)
β getAccessEntities API (2 ms)
β bad access token
expect(received).rejects.toThrow(expected)
Expected substring: "401"
Received message: "[CustomerProfileAPISDK:ERROR_ENTITIES] Error TypeError: Failed to parse URL from /data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email
at fetch (../node_modules/undici/index.js:110:15)
at http (../node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError: Invalid URL
at new Request (../node_modules/undici/lib/fetch/request.js:85:21)
at fetch (../node_modules/undici/lib/fetch/index.js:136:21)
at fetch (../node_modules/undici/index.js:107:20)
at http (../node_modules/swagger-client/lib/http/index.js:74:45) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email',
code: 'ERR_INVALID_URL'
}
}"
100 | })
101 | .catch(err => {
> 102 | reject(new codes[config.errorCode]({ sdkDetails, messageValues: reduceError(err) }))
| ^
103 | })
104 | })
105 | }
at fetch (../node_modules/undici/index.js:110:15)
at http (../node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError: Invalid URL
at new Request (../node_modules/undici/lib/fetch/request.js:85:21)
at fetch (../node_modules/undici/lib/fetch/index.js:136:21)
at fetch (../node_modules/undici/index.js:107:20)
at http (../node_modules/swagger-client/lib/http/index.js:74:45) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email',
code: 'ERR_INVALID_URL'
}
}
at new <anonymous> (../node_modules/@adobe/aio-lib-core-errors/src/AioCoreSDKErrorWrapper.js:33:9)
at ../src/openApiSDK.js:102:18
at Object.toThrow (../node_modules/expect/build/index.js:218:22)
at Object.toThrow (e2e.js:46:34)
β bad api key
expect(received).rejects.toThrow(expected)
Expected substring: "[CustomerProfileAPISDK:ERROR_ENTITIES] Error 403 - Forbidden ({\"error_code\":\"403003\",\"message\":\"Api Key is invalid\"})"
Received message: "[CustomerProfileAPISDK:ERROR_ENTITIES] Error TypeError: Failed to parse URL from /data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email
at fetch (../node_modules/undici/index.js:110:15)
at http (../node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError: Invalid URL
at new Request (../node_modules/undici/lib/fetch/request.js:85:21)
at fetch (../node_modules/undici/lib/fetch/index.js:136:21)
at fetch (../node_modules/undici/index.js:107:20)
at http (../node_modules/swagger-client/lib/http/index.js:74:45) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email',
code: 'ERR_INVALID_URL'
}
}"
100 | })
101 | .catch(err => {
> 102 | reject(new codes[config.errorCode]({ sdkDetails, messageValues: reduceError(err) }))
| ^
103 | })
104 | })
105 | }
at fetch (../node_modules/undici/index.js:110:15)
at http (../node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError: Invalid URL
at new Request (../node_modules/undici/lib/fetch/request.js:85:21)
at fetch (../node_modules/undici/lib/fetch/index.js:136:21)
at fetch (../node_modules/undici/index.js:107:20)
at http (../node_modules/swagger-client/lib/http/index.js:74:45) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email',
code: 'ERR_INVALID_URL'
}
}
at new <anonymous> (../node_modules/@adobe/aio-lib-core-errors/src/AioCoreSDKErrorWrapper.js:33:9)
at ../src/openApiSDK.js:102:18
at Object.toThrow (../node_modules/expect/build/index.js:218:22)
at Object.toThrow (e2e.js:54:34)
β getAccessEntities API
CustomerProfileAPIError: [CustomerProfileAPISDK:ERROR_ENTITIES] Error TypeError: Failed to parse URL from /data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email
100 | })
101 | .catch(err => {
> 102 | reject(new codes[config.errorCode]({ sdkDetails, messageValues: reduceError(err) }))
| ^
103 | })
104 | })
105 | }
at fetch (../node_modules/undici/index.js:110:15)
at http (../node_modules/swagger-client/lib/http/index.js:74:11) {
[cause]: TypeError: Invalid URL
at new Request (../node_modules/undici/lib/fetch/request.js:85:21)
at fetch (../node_modules/undici/lib/fetch/index.js:136:21)
at fetch (../node_modules/undici/index.js:107:20)
at http (../node_modules/swagger-client/lib/http/index.js:74:45) {
input: '/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=spaliwal%40adobe.com&entityIdNS=email',
code: 'ERR_INVALID_URL'
}
}
at new <anonymous> (../node_modules/@adobe/aio-lib-core-errors/src/AioCoreSDKErrorWrapper.js:33:9)
at ../src/openApiSDK.js:102:18
Test Suites: 1 failed, 1 total
Tests: 3 failed, 1 passed, 4 total
Snapshots: 0 total
Time: 1.953 s
Ran all test suites.
The input url does not begin with a scheme nor a host, thus it is an invalid url. Some sub-dependency is probably doing extra checks where the relative url is not combined with the base url.
Looking at the OpenAPI spec however, gives this "servers" url:
aio-lib-customer-profile/spec/api.json
Line 5230 in 7e63ce6
Note the url without the scheme
, in a web development context usually means it is a "protocol-relative" URL: https://www.paulirish.com/2010/the-protocol-relative-url/ and should be avoided
Add a https scheme to
aio-lib-customer-profile/spec/api.json
Line 5230 in 7e63ce6
api-latest.json
, check whichever is being used and delete the one that is not)Autocomplete is available for all methods, including the auto generated ones.
Autocomplete is not available for all methods, e.g. listComputedAttributes
is missing for example.
init
to get the SDK objectlistComputedAttributes
.Visual Studio Code is not using the types.d.ts
file for autocomplete, it is using the methods it introspects from the exported module. Find out how Visual Studio Code derives its autocomplete data from, so we can fix it in the library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.