Giter Club home page Giter Club logo

cli's Issues

Read DB calls via `@begin/data` fail

I deployed an app via begin app create and after successful app creation I hit the apps /games route.

If produces and error in the browser of:

{"message":"Internal Server Error"}

When I request the logs from the app using begin logs I get the following output which seems to indicate a permissions issue in access DynamoDB:

2022-09-22 13:30:08.134: START RequestId: c0ac7ff2-180e-4cbf-a843-aa655d8720d2 Version: $LATEST

2022-09-22 13:30:08.529: 2022-09-22T13:30:08.525Z	c0ac7ff2-180e-4cbf-a843-aa655d8720d2	ERROR	Invoke Error 	{"errorType":"AccessDeniedException","errorMessage":"User: arn:aws:sts::077166351318:assumed-role/A7JVBLPN0-Role-15FX9TMVNOFSS/A7JVBLPN0-AnyCatchallHTTPLambda-YYWmJVKObQNh is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:us-west-2:077166351318:parameter/Issue2Staging/tables/data because no identity-based policy allows the ssm:GetParameter action","code":"AccessDeniedException","message":"User: arn:aws:sts::077166351318:assumed-role/A7JVBLPN0-Role-15FX9TMVNOFSS/A7JVBLPN0-AnyCatchallHTTPLambda-YYWmJVKObQNh is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:us-west-2:077166351318:parameter/Issue2Staging/tables/data because no identity-based policy allows the ssm:GetParameter action","time":"2022-09-22T13:30:08.522Z","requestId":"1167fe27-582b-42dd-b401-6d97913b998c","statusCode":400,"retryable":false,"retryDelay":33.880872459309956,"stack":["AccessDeniedException: User: arn:aws:sts::077166351318:assumed-role/A7JVBLPN0-Role-15FX9TMVNOFSS/A7JVBLPN0-AnyCatchallHTTPLambda-YYWmJVKObQNh is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:us-west-2:077166351318:parameter/Issue2Staging/tables/data because no identity-based policy allows the ssm:GetParameter action","    at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)","    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)","    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)","    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:686:14)","    at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)","    at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)","    at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10","    at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)","    at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:688:12)","    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18)"]}

2022-09-22 13:30:08.533: REPORT RequestId: c0ac7ff2-180e-4cbf-a843-aa655d8720d2	Duration: 397.07 ms	Billed Duration: 398 ms	Memory Size: 1152 MB	Max Memory Used: 86 MB

2022-09-22 13:30:08.533: END RequestId: c0ac7ff2-180e-4cbf-a843-aa655d8720d2

2022-09-22 13:30:08.723: START RequestId: aa0860ad-8e3f-465a-a030-aa52d0021afb Version: $LATEST

2022-09-22 13:30:08.745: REPORT RequestId: aa0860ad-8e3f-465a-a030-aa52d0021afb	Duration: 21.45 ms	Billed Duration: 22 ms	Memory Size: 1152 MB	Max Memory Used: 86 MB

2022-09-22 13:30:08.745: END RequestId: aa0860ad-8e3f-465a-a030-aa52d0021afb

Feature: List apps and envs

It would be helpful to get a list of my apps and their environments from the CLI. IDs are helpful for destroying resources.

Maybe like

$ begin app list|ls --account|--all|-a

test-app <appID>
  ├── staging <envID>
  └── fooBar <envID>
test2
  └── production <envID>

This example lists all apps/envs in my account, but maybe there's a contextual variation in a project

~/myProject $ begin app list

my-project
  └── fooBar <envID>

Or maybe the list command isn't a subcommand of app?

$ begin account apps
...

When I deploy a new app it reports error

When I deploy a new app it reports app not found error. This may be because another build is stalled while building. I don't know how simultaneous builds affect each other.

➜  enhance.dev git:(test-begin-deploy) begin deploy
This project doesn't appear to be associated with a Begin app
? Would you like to create a Begin app based on this project? (Y/n) · true
? What would you like to name your app? · test-edotdev
? What would you like to name your first environment? · staging
Added appID 'RNMN9KHW' to project, be sure to commit this change!
Archived project in 317ms
Uploading project in 1 part
Error: app_not_found
➜  enhance.dev git:(test-begin-deploy) ✗

begin dev should report when another begin dev is running

If you have a terminal open with begin dev running and you try and run it from another terminal then the error is:

Begin dev server (0.0.29)

✓ Sandbox Found Architect project manifest: .arc
✓ Sandbox No custom testing environment variables found

Then it exits.

Pin version of @begin/validator

Older versions of the CLI were picking up a newer version of @begin/validator so the generated code didn't match the validator installed.

`begin dev` throws an exception

The stack trace is:

Error: Cannot find module './app'
Require stack:
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/pragmas/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/index.js
- /snapshot/cli/node_modules/@architect/hydrate/src/hydrate.js
- /snapshot/cli/node_modules/@architect/hydrate/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/sandbox/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/cli/index.js
- /snapshot/cli/src/commands/dev/index.js
- /snapshot/cli/src/commands/index.js
- /snapshot/cli/src/index.js
- /snapshot/cli/src/_main.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.

Deploy + create app in one command might be a race condition

Inside an app that hasn't been deployed:

begin app deploy
This project doesn't appear to be associated with a Begin app
? Would you like to create a Begin app based on this project? (Y/n) · true
? What would you like to name your app? · enhance-alpine
? What would you like to name your first environment? · staging
Added appID 'ZDLV8856' to project, be sure to commit this change!
Archived project in 113ms
Uploading project in 1 part
Error: app_not_found

Update fails when using `main` channel

Steps to reproduce:

Begin version: 0.0.18
✓ ~/git/begin/test-projects/cli/test/new-proj
⮑  begin update --use main
Checking for latest version
Downloading https://dl.begin.com/releases/main/begin-x64-darwin.zip (25.31 MiB)
Got 25.31 MiB of 25.31 MiB (100%)
Upgrading Begin to main-0259b9a
Updated /Users/begin/.begin/begin
Successfully upgraded Begin!
✓ ~/git/begin/test-projects/cli/test/new-proj
⮑  begin update --use latest
Checking for latest version
Error: Invalid Version: main-0259b9a
``

generated project issues

  • has a models folder (shouldn't have that by default)
  • missing devDependencies key w deps @architect/sandbox and eslint (also missing eslint config in package.json)
  • missing lint command from scripts

Fix undefined build exception

Should a Begin build fail for strange or unusual circumstances, we are currently getting the following build exception: Error: Begin exception: undefined

We need to fix whatever error bubbling we expect to be happening here.

Error: Cannot find module './app'

Steps to reproduce:

  1. Install the Begin CLI version 0.0.17.
  2. Create a new project begin new project --name new-proj --p ./new-proj
  3. cd into the newly created project
  4. Run begin dev. This should produce the error:
Error: Cannot find module './app'
Require stack:
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/pragmas/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/index.js
- /snapshot/cli/node_modules/@architect/hydrate/src/hydrate.js
- /snapshot/cli/node_modules/@architect/hydrate/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/sandbox/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/cli/index.js
- /snapshot/cli/src/commands/dev/index.js
- /snapshot/cli/src/commands/index.js
- /snapshot/cli/src/index.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.

This just started happening after @architect/sandbox v5.3.2 was released.

If you:

  1. Clone the project at commit has 32228e436abf0a1ea691801510416ba06ab3dcae
  2. Update the @architect/sandbox dependency to v5.3.2
  3. npm run build
  4. and try to reproduce with the newly built binary then begin dev starts without complaint.

I'm at a loss as to why the updated @architect/sandbox package would affect the compiled binary.

Optionally add auth to pages/routes/api's

If the app has auth added to it via the begin generate auth command when adding new pages/routes/api's there should be an option to add the auth check code to the generated code.

Deploys stalling out

Multiple reports of deploys stalling (and eventually timing) out. Repro steps:

begin new project -p test-project
cd test-project
begin generate scaffold Game day:date time:time facility:string

arc-plugin-enhance v1.0.15 throws validation error

Pulling in the latest arc-plugin-enhance results in the following error when you also run begin generate scaffold.

Error: Validation error:
- Plugin requires conflicting @tables item: data, plugin: enhance/arc-plugin-enhance, method: set.undefined

begin generate should not throw an error if it's not in a project directory

If you run generate before creating a project it throws an error and should instead gracefully report you must create a project first.

⮑  begin generate scaffold Game day:date time:time facility:string
Installing aws-sdk as a development dependency
Installing npm dependencies
(node:31474) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open './package.json'
    at Object.openSync (fs.js:497:3)
    at Object.openSync (pkg/prelude/bootstrap.js:739:32)
    at Object.readFileSync (fs.js:393:35)
    at readFileSync (pkg/prelude/bootstrap.js:1025:36)
    at installDependencies (/snapshot/cli/src/lib/npm-commands.js)
    at generate (/snapshot/cli/src/commands/generate/generators/_generate/index.js)
    at Object.action (/snapshot/cli/src/commands/generate/generators/scaffold/action.js)
    at action (/snapshot/cli/src/commands/generate/index.js)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:60:5)
    at Function.runMain (pkg/prelude/bootstrap.js:1848:13)
(Use `begin --trace-warnings ...` to show where the warning was created)
(node:31474) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:31474) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

schema to form should handle $refs

Using this schemas:

{
  "$id": "https://example.com/schemas/customer",
  "$schema": "https://json-schema.org/draft/2020-12/schema",

  "type": "object",
  "properties": {
    "first_name": { "type": "string" },
    "last_name": { "type": "string" },
    "shipping_address": { "$ref": "/schemas/address" },
    "billing_address": { "$ref": "/schemas/address" }
  },
  "required": ["first_name", "last_name", "shipping_address", "billing_address"],

  "$defs": {
    "address": {
      "$id": "/schemas/address",
      "$schema": "http://json-schema.org/draft-07/schema#",

      "type": "object",
      "properties": {
        "street_address": { "type": "string" },
        "city": { "type": "string" },
        "state": { "$ref": "#/definitions/state" }
      },
      "required": ["street_address", "city", "state"],

      "definitions": {
        "state": { "enum": ["CA", "NY", "... etc ..."] }
      }
    }
  }
}

Should produce a form with two text inputs followed by two address inputs.

format `package.json`

generating a new project the package.json is on one line; would be nice to hit it w JSON.stringify(pkg, null, 2) before write

Remove el-header & el-footer from model generator

When using the generate scaffold model on a project to just add a model an error is thrown when loaded in the browser.
We reference <el-header> and <el-footer> in the templates and they will not be a random project Or could be deleted by the user before running this generator.

Can't "begin app destroy"

Maybe because these are legacy, but I can't destroy any app:

begin app list
'testing' (app ID: CZPMLBHM)
  ├── 'staging' (env ID: C46XWSSTF): https://color-l1n.begin.app
  └── 'anotherOne' (env ID: CDFL24RDP): https://create-wnt.begin.app
'foobar' (app ID: DSQSDJNJ)
  └── (no app environments)
'idk' (app ID: DVRSZ9GB)
  └── (no app environments)
'CLI test' (app ID: HDQ7P0J7)
  └── (no app environments)
'test3' (app ID: KVGPLVRP)
  └── (no app environments)
'test2' (app ID: LHW49476)
  └── (no app environments)
begin app destroy --app LHW49476
Error: No Begin app found to destroy

I can destroy apps I just created.
Probably just need to reset my account and delete all apps.

CLI updates

  • Get rid of model/new.mjs
  • Add new form to bottom of list page
  • Move list generation code to generator in CLI ✅

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.