GithubHelp home page GithubHelp logo

googlecodelabs / cloud-slack-bot Goto Github PK

View Code? Open in Web Editor NEW
65.0 9.0 40.0 425 KB

Build a Slack Bot with Node.js on Cloud Run

Home Page: https://codelabs.developers.google.com/codelabs/cloud-slack-bot/

License: Apache License 2.0

JavaScript 100.00%

cloud-slack-bot's Introduction

Build a Slack Bot with Node.js on Cloud Run

This repository contains the source code for the Build a Slack Bot with Node.js on Cloud Run Google codelab.

Build Status

Resources

Codelabs and Samples

Documentation

Contributing

Contributions welcome!

See CONTRIBUTING.md.

License

Apache Version 2.0

See LICENSE.

cloud-slack-bot's People

Contributors

dinagraves avatar donghoon-song avatar mco-gh avatar picardparis avatar pineoc avatar tswast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-slack-bot's Issues

Error occurred during docker run container

Hi, I have some error on this project.
(When i study https://google.qwiklabs.com/focuses/635, Testing a Docker image locally)
I guess this error can occur botkit node version support.

google**_student@cloudshell:~/cloud-slack-bot/step-4-update (qwiklabs-gcp-***)$ kubectl logs slack-codelab-7f5f547fcf-rdg7j
/src/node_modules/botkit/lib/SlackBot.js:235
            let timestamp = req.header('X-Slack-Request-Timestamp');
            ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/src/node_modules/botkit/lib/Botkit.js:2:16)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)

When I used it like this Dockerfile, no error occurred.

FROM node:7
COPY package.json /src/package.json
WORKDIR /src
RUN npm install
COPY kittenbot.js /src
CMD ["node", "/src/kittenbot.js"]

ref: https://stackoverflow.com/questions/41960142/block-scoped-declarations-not-yet-supported-outside-strict-mode

I'm not sure this change can be solutions.
please check!

Thanks.

App does not start and fails with message "Cannot find module 'request'"

Issue

I'm currently updating the parent codelab to deploy cloud-slack-bot to Cloud Run (incl. removing usage of Container Registry):

  • ✔️ Cloud Build does build/deploy the container (Dockerfile ok)
  • ❌ The container fails to start with this error message: Cannot find module 'request'
  • ℹ️ This has been reproduced with the source under cloud-slack-bot/start
  • cloud-slack-bot/extra-credit has probably the same issue

Reproduction steps

git clone https://github.com/googlecodelabs/cloud-slack-bot.git
cd cloud-slack-bot/start
gcloud run deploy kittenbot \
  --source . \
  --platform managed \
  --region $REGION \
  --set-env-vars PROJECT_ID=$PROJECT_ID \
  --allow-unauthenticated

Logs

internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'request'
Require stack:
- /src/node_modules/botbuilder-adapter-slack/lib/botworker.js
- /src/node_modules/botbuilder-adapter-slack/lib/slack_adapter.js
- /src/node_modules/botbuilder-adapter-slack/lib/index.js
- /src/kittenbot.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/src/node_modules/botbuilder-adapter-slack/lib/botworker.js:21:17)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/src/node_modules/botbuilder-adapter-slack/lib/botworker.js',
'/src/node_modules/botbuilder-adapter-slack/lib/slack_adapter.js',
'/src/node_modules/botbuilder-adapter-slack/lib/index.js',
'/src/kittenbot.js'
]
}
Container called exit(1).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.