Hi Team,
I have created mesh project and it is running on local. Then i have created aio project using aio app init and aligned my mesh project to myaioproject/actions/mesh/<all files...>
Then i have created index.js file as entry file inside
myaioproject/actions/mesh/index.js
then i have run npx mesh build and npx mesh dev under myaioproject/actions/meshand project is running fine
manifest.yml file
Below is index.js
Views
Replies
Total Likes
Hi @HeenaMadan ,
The 503 errors and erratic behavior you're facing when deploying your Adobe I/O App Builder (AIO) + GraphQL Mesh project typically arise due to one or more of the following issues:
1. Asynchronous Issues or Cold Start Timeouts
- Adobe I/O Runtime (based on Apache OpenWhisk) has a cold start time (~3–5 seconds).
- If your Mutation.import() method or other Mesh API resolver calls are async-heavy, they may fail to resolve in time under cold starts.
2. Missing or Malformed Inputs (brandId)
Your code uses regex to extract brandId from a GraphQL-style string:
const brandId = params.query.match(/brandId:\s*"([^"]+)"/)?.[1];
If params.query is undefined or not structured as expected, brandId will be undefined, breaking downstream logic.
3. Mesh Server Not Bootstrapped Correctly in Adobe I/O Action
- Mesh projects typically spin up a server or use heavy GraphQL code requiring pre-built schema loading.
- You mentioned npx mesh dev works locally, but in Adobe Runtime, there's no persistent server only cold-started stateless functions.
4. Missing @adobe/aio-sdk Handling for Async Errors
- If a Promise is unresolved or a GraphQL execution throws unhandled exceptions, OpenWhisk might return 503.
Solution:
1. Ensure Mutation.import() is not undefined
Make sure resolvers/index.js exports Mutation.import properly and doesn’t rely on in-memory cache or Node.js-specific state.
// resolvers/index.js
const importHandler = async (_, { brandId }) => {
if (!brandId) throw new Error('brandId not provided');
// simulate response or actual API call
return { message: `Data imported for brand ${brandId}` };
};
exports.Mutation = {
import: importHandler
};
const body = typeof params.__ow_body === 'string' ? JSON.parse(params.__ow_body) : {};
const brandId = body.variables?.brandId || 'default-brand';
cd actions/mesh
npx mesh build
Ensure that dist/ contains:
- index.mjs
- schema.graphql
- .mesh folder (if needed)
If you're importing from ./resolvers/index, make sure it's bundled correctly or available in that path during runtime.
4. Avoid Cold Starts or Delay Heavy Mesh Initialization
Cold starts can be fatal. Preload mesh schema only once.
Inside index.js:
let meshInstance;
async function getMeshInstance () {
if (!meshInstance) {
const { getBuiltMesh } = require('@graphql-mesh/runtime')
meshInstance = await getBuiltMesh();
}
return meshInstance;
}
5. Check Deployment Structure
Make sure your project structure under actions/mesh looks like this:
actions/
└── mesh/
├── dist/
│ └── index.mjs
├── resolvers/
│ └── index.js
├── index.js (entry)
├── .mesh/
├── .meshrc.yaml
6. index.js Template
const { Core } = require('@adobe/aio-sdk')
const { errorResponse } = require('../utils')
const { Mutation } = require('./resolvers/index')
async function main (params) {
const logger = Core.Logger('main', { level: params.LOG_LEVEL || 'info' })
try {
logger.info('Calling the main action')
logger.debug(JSON.stringify(params))
const body = typeof params.__ow_body === 'string' ? JSON.parse(params.__ow_body) : {};
const brandId = body.variables?.brandId;
if (!brandId) throw new Error('brandId missing')
const content = await Mutation.import(null, { brandId })
return {
statusCode: 200,
body: content
}
} catch (error) {
logger.error(error)
return errorResponse(500, error.message || 'Internal Server Error', logger)
}
}
exports.main = main
7. Clean and Deploy Again
At the project root:
rm -rf .aio dist node_modules
npm install
aio app undeploy
aio app deploy
Regards,
Amit
Views
Replies
Total Likes
Thanks Amit to share this info.. very helpful.
i have a job which process around 0.3-0.5 million records and after processing need to push data to elastic and magento.
single node js mesh process deployed on aio gives 503 error service not available error and as per your info cold starts etc, i have created node js file which will call my mesh endpoint and do processing but with one cursor at a time. tested for around 100 cursors, its fine.
so do you think aio can handle this easily or any suggestion?
Also could you share official docs for Adobe I/O Runtime (based on Apache OpenWhisk) as i can see here handling multiple data better have queue. Or i can think we can do via chunking.
many thanks
Views
Replies
Total Likes
Hi @HeenaMadan
> i have a job which process around 0.3-0.5 million records and after processing need to push data to elastic and magento.
Is it a long-running async function or 0.5M requests to App Builder action?
> single node js mesh process deployed on aio gives 503 error service not available error and as per your info cold starts etc,
Is it happening for the first request? When do you receive a 503?
> i have created node js file which will call my mesh endpoint and do processing but with one cursor at a time. tested for around 100 cursors, its fine. so do you think aio can handle this easily or any suggestion?
Can you add an arch diagram? What's a cursor here? I don't see a reason why App Builder could not handle your use case. Maybe you can supply an arch diagram and I can confirm.
> Also could you share official docs for Adobe I/O Runtime
https://developer.adobe.com/app-builder/docs/guides/runtime_guides/
> as i can see here handling multiple data better have queue. Or i can think we can do via chunking.
App Builder also offers Custom events which are synonyms to using a message bus. You can publish events and then process them from the queue - thereby adding a buffer
Manik
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies