Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Deploying CIF Connector to Adobe I/O

Avatar

Level 2

Hi everyone,

I'll start by mentioning that I'm on a Mac. I'm building out my first AEM integration using the CIF components and the reference graphql implementation for the CIF (https://github.com/adobe/commerce-cif-graphql-integration-reference).  Everything works well and I have my local environment set up to be able to hit the Adobe I/O endpoints to retrieve graphql mock data from the reference implementation.  I'm also able to see my Adobe I/O endpoints when running both of the following commands:

 

 

wsk list
aio runtime list

 

 

When I run npm install and npm test, both succeed with 0 issues.  When I run npm run deploy, it also succeeds.  However, after that, my endpoints no longer work.  I have a coworker on Windows who is able to deploy EXACTLY the same codebase, and after he deploys it all works.  He sees the same exact output that I have, other than that he doesn't see the initial warnings. 

For example when I hit https://adobeioruntime.net/api/v1/web/{{runtime_namespace}}/graphql-reference/dispatcher using the products action.  Here are the logs from my deploy, and then from hitting the endpoint above after my deploy:

 

 

npm run deploy

> commerce-cif-graphql-integration-reference@1.0.0 deploy /Users/me/code/cif
> serverless deploy

Serverless: Configuration warning: Unrecognized provider 'openwhisk'
Serverless:  
Serverless: You're relying on provider plugin which doesn't provide a validation schema for its config.
Serverless: Please report the issue at its bug tracker linking: https://www.serverless.com/framework/docs/providers/aws/guide/plugins#extending-validation-schema
Serverless: You may turn off this message with "configValidationMode: off" setting
Serverless:  
Serverless: Configuration warning at root: unrecognized property 'resources'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:  
Serverless: Bundling with Webpack...
   129 modules
   138 modules
   896 modules
Serverless: Copying existing artifacts...
Serverless: Packaging service...
Serverless: Compiling Functions...
Serverless: Compiling Packages...
Serverless: Compiling API Gateway definitions...
Serverless: Compiling Rules...
Serverless: Compiling Triggers & Feeds...
Serverless: Compiling Service Bindings...
Serverless: Deploying Packages...
Serverless: Deploying Functions...
Serverless: Deployment successful!

Service Information
platform:	adobeioruntime.net
namespace:	_
service:	graphql-reference

packages:
graphql-reference

actions:
graphql-reference/dispatcher    graphql-reference/cart    graphql-reference/cif-schema    hello

triggers:
**no triggers deployed**

rules:
**no rules deployed**

endpoints (api-gw):

endpoints (web actions):
https://adobeioruntime.net/api/v1/web/xxxxx/graphql-reference/dispatcher
https://adobeioruntime.net/api/v1/web/xxxxx/graphql-reference/cif-schema

****************************************************************************************************************
Serverless: This service is safe to upgrade to a v2 Serverless Framework release
            Run "npm install serverless@^2.41.1" to upgrade
            Check: https://github.com/serverless/serverless/releases/tag/v2.0.0 for list of all breaking changes
****************************************************************************************************************

 

 

And then if I hit the endpoint and look at the activation logs using wsk or aio, the only real info I can see is this:

 

 

"duration": 398,
  "end": 1620842398736,
  "invokerInstanceId": {
    "instance": 2,
    "instanceType": "invoker",
    "uniqueName": "rt-invoker-2",
    "userMemory": "150000000000000 B"
  },
  "logs": [],
  "name": "dispatcher",
  "namespace": "xxxx-xxxx-xxxx",
  "podName": "wskrt-invoker-22-23316-prewarm-nodejs10",
  "publish": false,
  "response": {
    "result": {
      "error": "Initialization has failed due to: [object Object]"
    },
    "size": 61,
    "status": "action developer error",
    "success": false
  },

 

 

Has anyone ever seen this before?  Here are the versions of everything I've tried:

  • I've tried a ton of versions of Node: 10.x, 12.x, 14.x, 16.x and have the same issue regardless
  • npm v6.14.12
  • OpenWhisk v1.1.0 and 1.2.0

Any help would be greatly appreciated!

1 Accepted Solution

Avatar

Correct answer by
Level 2

Finally figured this out.  It turns out that our root .gitignore file had package-lock.json in it, and so the package-lock.json file that came with the repository wasn't pulled down for me when I first cloned the repo.  My coworker is the one who built it, so he had the correct package-lock.json file from the repository.  I'm not totally sure exactly what dependencies were causing the issues, but as soon as I got the correct package-lock.json file and re-ran npm install, everything worked. 

 

As a side note, this also fixed the warnings at the beginning of my npm run deploy output.

View solution in original post

2 Replies

Avatar

Level 2

I just want to follow up that I got wskdebug working and here's the output I see when I attempt to debug my action.

 

 

wskdebug /my_namespace/graphql-reference/dispatcher

 

Agent was already installed, but backup is still present. All good.

Debugging /my_namespace//my_namespace/graphql-reference/dispatcher on adobeioruntime.net

Debugger listening on ws://0.0.0.0:9229/b1365f86-0106-424c-8ed6-2d7fae1a7dd2

For help, see: https://nodejs.org/en/docs/inspector

Error during initialization: ArgumentError { name: 'ArgumentError', message: 'fetch must be a function' }

XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX

XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX

Following helper actions are not removed to keep shutdown fast. Remove using --cleanup if desired.

- /my_namespace/graphql-reference/dispatcher_wskdebug_original

 

Stopping container wskdebug--my-namespace-graphql-reference-dispatcher-1620915309064.

 

Error: Could not initialize action code on local debug container:

 

Initialization has failed due to: [object Object]

 

I'm pretty baffled by this.  How could I have a fetch issue with my deployment when my coworker deploys the same exact code and it works as expected!?  If anyone has any ideas, I'd love to hear them!

Avatar

Correct answer by
Level 2

Finally figured this out.  It turns out that our root .gitignore file had package-lock.json in it, and so the package-lock.json file that came with the repository wasn't pulled down for me when I first cloned the repo.  My coworker is the one who built it, so he had the correct package-lock.json file from the repository.  I'm not totally sure exactly what dependencies were causing the issues, but as soon as I got the correct package-lock.json file and re-ran npm install, everything worked. 

 

As a side note, this also fixed the warnings at the beginning of my npm run deploy output.