Expand my Community achievements bar.

SOLVED

Firefly Action logging

Avatar

Level 5

hi,

 

we created simple headless action and asset compute worker in the same project, logs are written using  (for example)

    logger.info('Calling the main action');
    console.log('Calling the main action');
 
When application is run using : aio app run, and action is triggered in the browser (https://80xx-xxheadlessapp-xxdemows.adobeioruntime.net/api/v1/web/xxHeadlessApp-0.0.1/myaction/)
in the cmd line we can only see logs coming from asset compute worker and there are no logs from action.
Executing: aio rt activation list
returns only activation list from worker
Executing: aio app logs, it returns empty
 
When application is run using : aio app run -- local (we set two docker images as per instructions, nodejs and openwhisk)
and action is executed (by running the same url  as above, https://80xx-xxheadlessapp-xxdemows.adobeioruntime.net/api/v1/web/xxHeadlessApp-0.0.1/myaction/) there's no debug lines of any kind (action or asset compute worker) in the cmd line.
 
Any advice how to make logs working ?
 
 
 
Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @nbg62 - so you got 2 separate questions:

1. `aio app run`, logs available from the asset compute worker, not available from the simple headless action. This is expected; because the asset compute worker (action) is invoked in a "non-blocking" mode, its activation record and logs are always saved (for 7 days); on the other hand, the headless action is invoked in a "blocking" mode (web request), so its activation record is not saved (when the action runs successfully). For debugging purpose, you can enable the activation record to be saved by adding this header to the web request "x-ow-extra-logging: on". Please remember to remove this header in production, as it may impact your action performance. More details at: https://www.adobe.io/apis/experienceplatform/runtime/docs.html#!adobedocs/adobeio-runtime/master/gui....

2. The problem you are seeing is because you are calling your action on I/O Runtime (at https://80xx-xxheadlessapp-xxdemows.adobeioruntime.net/api/v1/web/xxHeadlessApp-0.0.1/myaction/), while in the command line you are getting activation records from localhost (by running `aio app run --local`). Please note when you run your app in localhost, the action URL should be like https://localhost:3233/api/v1/web/guest/xxHeadlessApp-0.0.1/myaction.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

Hi @nbg62 - so you got 2 separate questions:

1. `aio app run`, logs available from the asset compute worker, not available from the simple headless action. This is expected; because the asset compute worker (action) is invoked in a "non-blocking" mode, its activation record and logs are always saved (for 7 days); on the other hand, the headless action is invoked in a "blocking" mode (web request), so its activation record is not saved (when the action runs successfully). For debugging purpose, you can enable the activation record to be saved by adding this header to the web request "x-ow-extra-logging: on". Please remember to remove this header in production, as it may impact your action performance. More details at: https://www.adobe.io/apis/experienceplatform/runtime/docs.html#!adobedocs/adobeio-runtime/master/gui....

2. The problem you are seeing is because you are calling your action on I/O Runtime (at https://80xx-xxheadlessapp-xxdemows.adobeioruntime.net/api/v1/web/xxHeadlessApp-0.0.1/myaction/), while in the command line you are getting activation records from localhost (by running `aio app run --local`). Please note when you run your app in localhost, the action URL should be like https://localhost:3233/api/v1/web/guest/xxHeadlessApp-0.0.1/myaction.