Expand my Community achievements bar.

SOLVED

SSL Certificates for Headfull apps & Persistent storage for Headless App

Avatar

Community Advisor and Adobe Champion

Hey Adobe Team! 

I'm working on couple of apps and would need some guidance around some of the issues i'm facing. 

 

a.) Headful app: I have a app (not published yet) and plan to publish it soon, recently i recieved emails regarding public key expiring for the app. How to fix this? How long does the certificate last or how often does it expire? 

What are the process to follow once app is pushed to production to ensure this does not affect the app? 

Like this one below expired this week. 

Anil_Umachigi_0-1649329263013.png

 

Per the docs, do we have to generate a Public key (if yes how? ) and Add it within project (as shown in image)? and that should do it?? 

Does the SSL issue apply to headless app as well? or any service built using that service account? 

 

b.) Persistent variable for cron job 

 

My second app is an headless app which would run every morning, i need to store successful run timeStamp for set of tasks to compare the next day. I was looking at State library but does not look like i can use that? 

Are files lib usefull here? not sure creating a file for this is a good approach? If this is files how do i create a file and read it. Could you please share example here. 

A json structure like below which would update every day after run and will be referred next day. What is the best approach within app builder framework? 

const lastRunStatus = {

"brandA" : "<timeStamp>",

"brandB" : "<timeStamp>"

}

 

Thank you!! 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

The keys are for the service accounts you have bound to your project.  They expire and need to be rotated to ensure the security of the service account.  It is not technically an App Builder thing but more a general Adobe auth service account general rule.  I don't really know the history behind the key rotation and expiring interval.

 

It has nothing to do with SSL connection to a microservice you host.  Its 100% the service technical account that the emails are related too.  They fill my inbox too.

 

B)  Why can you not use State?  If you set the TTL to -1 see adobe/aio-lib-state: A JavaScript abstraction on top of distributed/cloud DBs that exposes a simple ...

Not to say that's the right answer but it could work as well.
I use file store a lot for storing json structures and it works fine.  Since you only run this process once a day I would lean toward using the File store.  

 

Write json to file 

await fileLib.write(`mydir/myfilename.json`,JSON.stringify(myVarWithAValidJSObject))


Read json from file

//try

const myFileJson= await fileLib.read(`mydir/myfilename.json`)
const myJson = JSON.parse(myFileJson)
//catch

 

 

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

The keys are for the service accounts you have bound to your project.  They expire and need to be rotated to ensure the security of the service account.  It is not technically an App Builder thing but more a general Adobe auth service account general rule.  I don't really know the history behind the key rotation and expiring interval.

 

It has nothing to do with SSL connection to a microservice you host.  Its 100% the service technical account that the emails are related too.  They fill my inbox too.

 

B)  Why can you not use State?  If you set the TTL to -1 see adobe/aio-lib-state: A JavaScript abstraction on top of distributed/cloud DBs that exposes a simple ...

Not to say that's the right answer but it could work as well.
I use file store a lot for storing json structures and it works fine.  Since you only run this process once a day I would lean toward using the File store.  

 

Write json to file 

await fileLib.write(`mydir/myfilename.json`,JSON.stringify(myVarWithAValidJSObject))


Read json from file

//try

const myFileJson= await fileLib.read(`mydir/myfilename.json`)
const myJson = JSON.parse(myFileJson)
//catch

 

 

Avatar

Community Advisor and Adobe Champion

Thank you @dr_venture  Makes sense on the service accounts. 

re using State for this use case, i thought state is temporary and scoped to micro service run. Can it persist the next day if i store a variable in state? Is TTL configurable? 

Editing to add: 

So i see that i can use -1. Does it mean it exists until explicitly deleted? 

May be i can overwrite this on a daily basis. 

await state.put('key', { anObject: 'value' }, { ttl: -1 }) 

I will explore the file lib and report back here! 

 

Appreciate your guidance on this! 

Cheers!! 

 

Avatar

Community Advisor and Adobe Champion

@dr_venture I will use the same thread to add another question. 

is there any setting/variable that can be used to detect the app builder env (dev/staging/prod) ? This is to switch AEP sandbox within the code from dev to prod on publishing of the app. 

 

Thank you!