auth0-extensions / auth0-bitbucket-deploy Goto Github PK
View Code? Open in Web Editor NEWThis extension gives Auth0 customers the possibility to deploy Rules and Custom Database Connections from Bitbucket.
License: MIT License
This extension gives Auth0 customers the possibility to deploy Rules and Custom Database Connections from Bitbucket.
License: MIT License
When deploying from a BitBucket repository I receive the following error:
2017-05-03T08:37:52.155Z - Getting access token for randomness/tenant.eu.auth0.com
2017-05-03T08:37:53.509Z - Assets: {"rules":{"print-config":{"script":true,"metadata":true,"name":"print-config","scriptFile":"2ffb629dd2945fb89f87539b0df3ac3cbcc69764c905582cade9071b048a039a","metadataFile":"{\"enabled\":false,\"order\":100}"},"require-stuff":{"script":true,"metadata":true,"name":"require-stuff","metadataFile":"{\"enabled\":true,\"order\":10,\"stage\":\"login_success\"}","scriptFile":"6cb880292a470f15fb743fbf411fb0ebf7cb392e5b67f0158e3aa07237c0cdf0"}},"pages":{"login":{"metadata":true,"name":"login","metadataFile":"{\"enabled\":true}","htmlFile":"7b119f78faa3101c0bcd684ec307aa0bd9d9a72b3615f7fa8380f9926f265b24"},"password_reset":{"metadata":true,"name":"password_reset","htmlFile":"8f0b6646966aac7bb9c7f0ea0d7544fa077b3cb010aa2c30734dddfffc2c5c6b","metadataFile":"{\"enabled\":true}"}},"databases":[]}
2017-05-03T08:37:53.523Z - Updating pages...
2017-05-03T08:37:53.524Z - Updating login page...
2017-05-03T08:37:53.525Z - Error: Cannot read property 'clients' of undefined
2017-05-03T08:37:53.526Z - StackTrace: TypeError: Cannot read property 'clients' of undefined
at Object.a.getGlobalClientId (/data/auth0-bitbucket-deploy-2.2.js:1:28841)
at Object.a.updateLoginPage (/data/auth0-bitbucket-deploy-2.2.js:1:29926)
at Object.a.updatePages (/data/auth0-bitbucket-deploy-2.2.js:1:30149)
at /data/auth0-bitbucket-deploy-2.2.js:2:4427
at tryCatcher (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/util.js:24:31)
at Promise._settlePromiseFromHandler (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/promise.js:454:31)
at Promise._settlePromiseAt (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/promise.js:530:18)
at Promise._settlePromises (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/promise.js:646:14)
at bound (domain.js:287:14)
at Promise.runBound (domain.js:300:12)
at Async._drainQueue (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/async.js:182:12)
at Async._drainQueues (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/async.js:187:10)
at Immediate.Async.drainQueues [as _onImmediate] (/data/_verquire/mongoose/4.1.6/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
2017-05-03T08:37:53.526Z - Sending progress to Slack.
The Bitbucket API client should at least log why it is failing (in the progress logs)
I am using the BitBucket repo: https://bitbucket.org/sgmeyer/sgmeyer-demo-deploy/src. When using version 2.1 of the extension the Pages are not detected and not deploying. Here is a deploy log below. As you can see in the "assets" blob pages:{}
.
2017-03-31T13:39:18.264Z - Assets: {"rules":{"rule-1":{"script":true,"metadata":true,"name":"rule-1","metadataFile":"{\"enabled\":true,\"order\":10}","scriptFile":"function (user, context, callback) {\n\n if (context.clientName === 'TheAppToCheckAccessTo') {\n var d = new Date().getDay();\n\n if (d === 0 || d === 6) {\n return callback(new UnauthorizedError('This app is available during the week'));\n }\n }\n\n callback(null, user, context);\n}"}},"pages":{},"databases":[{"name":"Temp-Con","scripts":{"get_user":{"name":"get_user","scriptFile":"function getByEmail (email, callback) {\n //mine\n // This script should retrieve a user profile from your existing database,\n // without authenticating the user.\n // It is used to check if a user exists before executing flows that do not\n // require authentication (signup and password reset).\n //\n // There are three ways this script can finish:\n // 1. A user was successfully found. The profile should be in the following\n // format: https://auth0.com/docs/user-profile\n // callback(null, profile);\n // 2. A user was not found\n // callback(null);\n // 3. Something went wrong while trying to reach your database:\n // callback(new Error(\"my error message\"));\n\n var msg = \"Please implement the Get User script for this database connection \"\n + \"at https://manage.auth0.com/#/connections/database\";\n return callback(new Error(msg));\n}\n"},"login":{"name":"login","scriptFile":"function login (email, password, callback) {\n // HERE\n \n \n // This script should authenticate a user against the credentials stored in\n // your database.\n // It is executed when a user attempts to log in or immediately after signing\n // up (as a verification that the user was successfully signed up).\n // The `password` parameter of this function is in plain text. It must be\n // hashed/salted to match whatever is stored in your database. For example:\n //\n // var bcrypt = require('[email protected]');\n // bcrypt.compare(password, dbPasswordHash, function(err, res)) { ... }\n //\n // There are three ways this script can finish:\n // 1. The user's credentials are valid. The returned user profile should be in\n // the following format: https://auth0.com/docs/user-profile\n // callback(null, profile);\n // 2. The user's credentials are invalid\n // callback(new WrongUsernameOrPasswordError(email, \"my error message\"));\n // 3. Something went wrong while trying to reach your database\n // callback(new Error(\"my error message\"));\n //\n // A list of Node.js modules which can be referenced is available here:\n //\n // https://tehsis.github.io/webtaskio-canirequire/\n\n var msg = \"Please implement the Login script for this database connection \"\n + \"at https://manage.auth0.com/#/connections/database\";\n return callback(new Error(msg));\n}\n"}}}]}
2017-03-31T13:39:18.274Z - Updating pages...
2017-03-31T13:39:18.275Z - Validating that configured databases exist in Auth0...
2017-03-31T13:39:18.309Z - Validating rules...
2017-03-31T13:39:18.334Z - Processing connection Temp-Con
2017-03-31T13:39:18.334Z - Import User to Auth0 enabled: true. Allowed scripts: [
"get_user",
"login"
]
2017-03-31T13:39:18.334Z - Updating database con_oLicxaHKMi2jkAr2: {
"mfa": {
"active": true,
"return_enroll_settings": true
},
"disable_signup": false,
"requires_username": true,
"brute_force_protection": true,
"enabledDatabaseCustomization": true,
"customScripts": {
"get_user": "function getByEmail (email, callback) {\n //mine\n // This script should retrieve a user profile from your existing database,\n // without authenticating the user.\n // It is used to check if a user exists before executing flows that do not\n // require authentication (signup and password reset).\n //\n // There are three ways this script can finish:\n // 1. A user was successfully found. The profile should be in the following\n // format: https://auth0.com/docs/user-profile\n // callback(null, profile);\n // 2. A user was not found\n // callback(null);\n // 3. Something went wrong while trying to reach your database:\n // callback(new Error(\"my error message\"));\n\n var msg = \"Please implement the Get User script for this database connection \"\n + \"at https://manage.auth0.com/#/connections/database\";\n return callback(new Error(msg));\n}\n",
"login": "function login (email, password, callback) {\n // HERE\n \n \n // This script should authenticate a user against the credentials stored in\n // your database.\n // It is executed when a user attempts to log in or immediately after signing\n // up (as a verification that the user was successfully signed up).\n // The `password` parameter of this function is in plain text. It must be\n // hashed/salted to match whatever is stored in your database. For example:\n //\n // var bcrypt = require('[email protected]');\n // bcrypt.compare(password, dbPasswordHash, function(err, res)) { ... }\n //\n // There are three ways this script can finish:\n // 1. The user's credentials are valid. The returned user profile should be in\n // the following format: https://auth0.com/docs/user-profile\n // callback(null, profile);\n // 2. The user's credentials are invalid\n // callback(new WrongUsernameOrPasswordError(email, \"my error message\"));\n // 3. Something went wrong while trying to reach your database\n // callback(new Error(\"my error message\"));\n //\n // A list of Node.js modules which can be referenced is available here:\n //\n // https://tehsis.github.io/webtaskio-canirequire/\n\n var msg = \"Please implement the Login script for this database connection \"\n + \"at https://manage.auth0.com/#/connections/database\";\n return callback(new Error(msg));\n}\n"
},
"import_mode": true
}
2017-03-31T13:39:18.372Z - Deleting rules that no longer exist in the repository...
2017-03-31T13:39:18.373Z - Existing rules: [
{
"id": "rul_82cyvMCn9fxGut6c",
"name": "rule-1",
"stage": "login_success",
"order": 10
}
]
2017-03-31T13:39:18.373Z - Updating rules...
2017-03-31T13:39:18.373Z - Existing rules: [
{
"id": "rul_82cyvMCn9fxGut6c",
"name": "rule-1",
"stage": "login_success",
"order": 10
}
]
2017-03-31T13:39:18.374Z - Processing rule rule-1
2017-03-31T13:39:18.374Z - Updating rule rule-1 (rul_82cyvMCn9fxGut6c):{
"name": "rule-1",
"script": "function (user, context, callback) {\n\n if (context.clientName === 'TheAppToCheckAccessTo') {\n var d = new Date().getDay();\n\n if (d === 0 || d === 6) {\n return callback(new UnauthorizedError('This app is available during the week'));\n }\n }\n\n callback(null, user, context);\n}",
"enabled": true,
"order": 10
}
2017-03-31T13:39:18.397Z - Done.
We're trying (where possible) to use hooks; having to manually deploy them after a change is not a attractive solution for us.
Do you have deploying Hooks from Bitbucket on your roadmap?
Today I noticed an update (2.6) to this extension on our Auth0 Management Dashboard and tried it on our test tenant, but it no longer works. I get a no auth mechanism defined
on every attempt of running the deploy.
Figured I would have look and see if I can help out with a fix or get some extra info debugging. But I'm a bit confused and unsure if I am even in the right place. Latest release seems to be 2.2.4 looking at the tags and commits. But the docs make references to a 2.3 version, and I've been running version 2.5 successfully for a few weeks on my company's Auth0 instance. On top of that I noticed another repo here that seems to have to same functionality as this repo, even many overlap in code, but with the other deploy plugins combined into a single repo, it has no releases yet, but current version is set 1.1.0.
Can someone point me in the right direction?
Would it be possible to support deploying to the Fetch User Profile Script
of the "Custom Social Connections" Extension as well?
Would love if it were possible to have every custom code inside Auth0 under version control.
We are currently using API v1, but v2 is available: https://blog.bitbucket.org/2013/11/12/api-2-0-new-function-and-enhanced-usability/
The extension is currently showing the tenant picker which is not needed.
I noticed that the github-deploy extension has added support for locally hosted repositories. Any chance of the same thing happening with this extension? We'd like to use the bitbucket-deploy extension, but it would need to support our locally-hosted bitbucket.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.