raykoshima
raykoshima•12mo ago

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));
}
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\"}"
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
}
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\"}"
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
No description
6 Replies
raykoshima
raykoshimaOP•12mo ago
nvm i figured it out
FFO
FFO•12mo ago
Sorry for my late reply, would you mind sharing the solution? Might help others. 😄
raykoshima
raykoshimaOP•12mo ago
I does notthing wait for next day and try again somehow it work lmao i don't know what cause it maybe the function name? I change it to mapLineOauth both name and funtion name
raykoshima
raykoshimaOP•12mo ago
now it look like this
No description
raykoshima
raykoshimaOP•12mo ago
No description
FFO
FFO•12mo ago
haha, anyway thanks for sharing 😄

Did you find this page helpful?