We have run into an error: {{error}}
If this is not right, please report an issue
================================================
FILE: oauth-service/html/home.template.html
================================================
Redirecting to VS Code...
Unable to redirect? Configure manually.
- Copy the token to clipboard.
- Inside VS Code, open the Command Palette.
- Pick Chat: Configure Slack Access Token.
- Paste the token.
Report an issue
================================================
FILE: oauth-service/html.d.ts
================================================
declare module "*.html" {
const value: string;
export default value;
}
================================================
FILE: oauth-service/package.json
================================================
{
"name": "vscode-chat-oauth-service",
"description": "Serverless app to handle Slack OAuth for vscode-chat",
"version": "1.0.0",
"main": "handler.js",
"scripts": {
"start": "npx serverless offline start"
},
"dependencies": {
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"source-map-support": "^0.5.0"
},
"devDependencies": {
"@types/aws-lambda": "8.10.1",
"@types/node": "^8.0.57",
"html-loader": "^0.5.5",
"serverless-domain-manager": "^2.6.0",
"serverless-offline": "^3.25.8",
"serverless-webpack": "^5.1.1",
"ts-loader": "^4.2.0",
"typescript": "^2.8.1",
"webpack": "^4.5.0"
}
}
================================================
FILE: oauth-service/serverless.yml
================================================
service:
name: vscode-chat-oauth-service
plugins:
- serverless-webpack
- serverless-offline
- serverless-domain-manager
provider:
name: aws
runtime: nodejs8.10
environment: ${file(./env.yml):${opt:stage, self:provider.stage}}
functions:
slack-redirect:
handler: handler.slackRedirect
timeout: 10
events:
- http:
method: get
path: slack_redirect
discord-redirect:
handler: handler.discordRedirect
timeout: 10
events:
- http:
method: get
path: discord_redirect
home:
handler: handler.home
events:
- http:
method: get
path: /
custom:
customDomain:
domainName: vscode.chat
certificateArn: arn:aws:acm:us-east-1:750374355341:certificate/dd3d7f2f-e25f-46b9-8cad-93784e9b2e9b
stage: ${self:provider.stage}
createRoute53Record: true
================================================
FILE: oauth-service/source-map-install.js
================================================
require('source-map-support').install();
================================================
FILE: oauth-service/tsconfig.json
================================================
{
"compilerOptions": {
"sourceMap": true,
"target": "es6",
"lib": [
"esnext"
],
"moduleResolution": "node"
},
"exclude": [
"node_modules"
]
}
================================================
FILE: oauth-service/utils.ts
================================================
import { APIGatewayEvent } from "aws-lambda";
export const parseQueryParams = (event: APIGatewayEvent) => {
const { queryStringParameters } = event;
let error, code;
if (!!queryStringParameters) {
code = queryStringParameters.code;
error = queryStringParameters.error;
} else {
error = "no_code_param";
}
return { code, error };
};
export const getIssueUrl = (errorMessage: string, serviceName: string) => {
const encode = encodeURIComponent;
const title = `[oauth-service] Sign in with ${serviceName} failed: ${errorMessage}`;
const body = `- Extension version:\n- VS Code version:`;
const baseUrl = "https://github.com/karigari/vscode-chat/issues/new/";
return `${baseUrl}?title=${encode(title)}&body=${encode(body)}`;
};
export const getRedirect = (token: string, service: string, team: string) => {
return `vscode://karigari.chat/redirect?token=${token}&service=${service}&team=${team}`;
};
export const getRedirectError = (errorMessage: string, serviceName: string) => {
return `vscode://karigari.chat/error?msg=${errorMessage}&service=${serviceName}`;
};
================================================
FILE: oauth-service/webpack.config.js
================================================
const path = require("path");
const slsw = require("serverless-webpack");
const entries = {};
Object.keys(slsw.lib.entries).forEach(
key => (entries[key] = ["./source-map-install.js", slsw.lib.entries[key]])
);
module.exports = {
mode: slsw.lib.webpack.isLocal ? "development" : "production",
entry: entries,
devtool: "source-map",
resolve: {
extensions: [".js", ".jsx", ".json", ".ts", ".tsx", ".html"]
},
output: {
libraryTarget: "commonjs",
path: path.join(__dirname, ".webpack"),
filename: "[name].js"
},
target: "node",
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader" },
{ test: /\.html$/, loader: "html-loader" }
]
}
};
================================================
FILE: oauth-service-2/.gcloudignore
================================================
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
node_modules
================================================
FILE: oauth-service-2/README.md
================================================
# Oauth redirection service
## Running locally
```
npm start
```
## Deployment
```
gcloud functions deploy slackRedirect --set-env-vars SLACK_CLIENT_ID=