DaiziaD
ZITADEL16mo ago
7 replies
Daizia

action didn't check for external Idp ID

I add an action to log info out
here is my code
let logger = require("zitadel/log")
function lineOauthAutofill(ctx , api){

    if (ctx.v1.externalUser.externalIdpId != "280262665769582647") {
        return
      }
    logger.log('[RAY] Hello this function is running')
    logger.log('[RAY] id is '+ ctx.v1.externalUser.externalIdpId)
    logger.log('Line ProviderInfo: ' + JSON.stringify(ctx.v1.providerInfo));
}

and I add a flow in picture
but log is output just this
time="2024-09-18T10:05:16Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:05:16.726923797Z\",\"took\":0,\"message\":\"action run started\",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"
time="2024-09-18T10:05:16Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:05:16.727790594Z\",\"took\":866797,\"message\":\"action run succeeded\",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"


but then I remove this line
if (ctx.v1.externalUser.externalIdpId != "280262665769582647") {
        return
      }

log output have
time="2024-09-18T10:03:05Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:03:05.129208814Z\",\"took\":0,\"message\":\"action run started\",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"
time="2024-09-18T10:03:05Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:03:05.130209759Z\",\"took\":0,\"message\":\"[RAY] Hello this function is running\",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"
time="2024-09-18T10:03:05Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:03:05.130333127Z\",\"took\":0,\"message\":\"[RAY] id is 285470657381138487\",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"
time="2024-09-18T10:03:05Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:03:05.130920048Z\",\"took\":0,\"message\":\"Line ProviderInfo: {\\\"rawInfo\\\":info",\"logLevel\":\"info\",\"instanceId\":\"280262665769582647\"}"
time="2024-09-18T10:03:05Z" level=info msg="log record emitted" caller="/home/runner/work/zitadel/zitadel/internal/logstore/emitters/stdout/stdout.go:19" record="{\"logDate\":\"2024-09-18T10:03:05.131074837Z\",\"took\":1866053,\"message\":\"action run failed: could not convert [object Promise] to error\",\"logLevel\":\"error\",\"instanceId\":\"280262665769582647\"}"

you can see [RAY] is log in message
image.png
Was this page helpful?