Question
Deployed Mesh project on Aio gives 503 sometimes or different behavior
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
packages:
meshwebshop:
actions:
mesh:
function: actions/mesh/index.js
web: true
runtime: 'nodejs:18'
inputs:
LOG_LEVEL: 'debug'
Below is index.js
/*
* <license header>
*/
/**
* This is a sample action showcasing how to access an external API
*
* Note:
* You might want to disable authentication and authorization checks against Adobe Identity Management System for a generic action. In that case:
* - Remove the require-adobe-auth annotation for this action in the manifest.yml of your application
* - Remove the Authorization header from the array passed in checkMissingRequestInputs
* - The two steps above imply that every client knowing the URL to this deployed action will be able to invoke it without any authentication and authorization checks against Adobe Identity Management System
* - Make sure to validate these changes against your security requirements before deploying the action
*/
const fetch = require('node-fetch')
const { Core } = require('@adobe/aio-sdk')
const { errorResponse, getBearerToken, stringParameters, checkMissingRequestInputs } = require('../utils')
const { Mutation } = require('./resolvers/index');
// main function that will be executed by Adobe I/O Runtime
async function main (params) {
// create a Logger
const logger = Core.Logger('main', { level: params.LOG_LEVEL || 'info' })
try {
// 'info' is the default level if not set
logger.info('Calling the main action')
// log parameters, only if params.LOG_LEVEL === 'debug'
logger.debug(stringParameters(params))
const brandId = params.query.match(/brandId:\s*"([^"]+)"/)?.[1];
const content = await Mutation.import(null, { brandId: brandId });
const response = {
statusCode: 200,
body: content
}
// log the response status code
logger.info(`${response.statusCode}: successful request`)
return response
} catch (error) {
// log any server errors
logger.error(error)
// return with 500
return errorResponse(500, 'server error', logger)
}
}
exports.main = main
Sometimes i get 503 service not available error & process starts in background.. print in logs
Get 200 ok when only hardcoded response is added and no api interaction in the resolvers.
now getting no brandid found.
I have run below commands still no luck
at root of project:
$ rm -rf .aio dist
$ rm -rf .aio dist
aio app depoy
even did aio app undeploy then deploy still same.
Anybody help us here?
Thanks
Heena
