bnason
bnason
Explore posts from servers
CDCloudflare Developers
Created by bnason on 6/25/2024 in #workers-help
Error 1101 on code surrounded by try/catch
As you can see it stops on console.log(3) but it should show console.log(6) if there was an exception thrown!
4 replies
CDCloudflare Developers
Created by bnason on 6/25/2024 in #workers-help
Error 1101 on code surrounded by try/catch
This is what tailing the logs shows:
{
"outcome": "exception",
"scriptName": "pages-worker--3037681-production",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1719317831505
}
],
"logs": [
{
"message": [
1
],
"level": "log",
"timestamp": 1719317831505
},
{
"message": [
2
],
"level": "log",
"timestamp": 1719317831505
},
{
"message": [
3
],
"level": "log",
"timestamp": 1719317831505
}
],
"eventTimestamp": 1719317831505,
"event": {
"response": {
"status": 500
}
},
"id": 1
}
{
"outcome": "exception",
"scriptName": "pages-worker--3037681-production",
"diagnosticsChannelEvents": [],
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1719317831505
}
],
"logs": [
{
"message": [
1
],
"level": "log",
"timestamp": 1719317831505
},
{
"message": [
2
],
"level": "log",
"timestamp": 1719317831505
},
{
"message": [
3
],
"level": "log",
"timestamp": 1719317831505
}
],
"eventTimestamp": 1719317831505,
"event": {
"response": {
"status": 500
}
},
"id": 1
}
4 replies
CDCloudflare Developers
Created by bnason on 6/25/2024 in #workers-help
Error 1101 on code surrounded by try/catch
import { SAML } from 'saml-login'

export default defineEventHandler(async (event) => {
try {
console.log(1)
const saml = new SAML()

console.log(2)
const options: Parameters<typeof saml.generateAuthenticationUrl>[0] = {
providerSingleSignOnUrl: 'xxx',
applicationEntityId: 'xxx',
applicationCallbackAssertionConsumerServiceUrl: `http${process.env.NODE_ENV === 'production' ? 's' : ''}://${
process.env.SITE_DOMAIN
}/auth/saml/sp/acs`,
allowCreate: false,
}
console.log(3)
const redirectUrl = await saml.generateAuthenticationUrl(options)

console.log(4)
sendRedirect(event, redirectUrl)

console.log(5)
return ''
} catch (e) {
console.log(6)
if (e instanceof Error) {
console.log(e.message)
}

return 'error'
}
})
import { SAML } from 'saml-login'

export default defineEventHandler(async (event) => {
try {
console.log(1)
const saml = new SAML()

console.log(2)
const options: Parameters<typeof saml.generateAuthenticationUrl>[0] = {
providerSingleSignOnUrl: 'xxx',
applicationEntityId: 'xxx',
applicationCallbackAssertionConsumerServiceUrl: `http${process.env.NODE_ENV === 'production' ? 's' : ''}://${
process.env.SITE_DOMAIN
}/auth/saml/sp/acs`,
allowCreate: false,
}
console.log(3)
const redirectUrl = await saml.generateAuthenticationUrl(options)

console.log(4)
sendRedirect(event, redirectUrl)

console.log(5)
return ''
} catch (e) {
console.log(6)
if (e instanceof Error) {
console.log(e.message)
}

return 'error'
}
})
4 replies
CDCloudflare Developers
Created by bnason on 6/24/2024 in #workers-help
import is undefined
That did not seem to help unfortunately
4 replies
CDCloudflare Developers
Created by bnason on 6/24/2024 in #workers-help
import is undefined
let me try that thanks
4 replies
CDCloudflare Developers
Created by bnason on 6/24/2024 in #wrangler
So wrangler just made me go through the
Ok I did a wrangler login and that completed the flow. The issue I looked at said the deploy process might be hitting an extra CloudFlare challenge that is returning HTML instead of whatever the oauth process needed.
3 replies
CDCloudflare Developers
Created by bnason on 6/22/2024 in #workers-help
SAML
Is there a way to know what exactly is triggering that error?
2 replies