Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serve static hook error #609

Closed
purplecabbage opened this issue Sep 17, 2022 · 9 comments · Fixed by #617
Closed

serve static hook error #609

purplecabbage opened this issue Sep 17, 2022 · 9 comments · Fixed by #617
Assignees
Labels
bug Something isn't working

Comments

@purplecabbage
Copy link
Member

Reproduce Scenario (including but not limited to)

Steps to Reproduce

add a hook, serve-static: echo serve-static
aio app run

Environment Info


  System:
    OS: macOS 12.5
    CPU: (10) x64 Apple M1 Max
    Memory: 748.13 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node
    Yarn: Not Found
    npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm
  Virtualization:
    Docker: 20.10.17 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli-next: 8.3.0-pre.2022-09-08.sha-d5666ea8

  Proxies:
    http: (not set)
    https: (not set)
  CLI plugins:
    core:
      @adobe/aio-cli-next 8.3.0-pre.2022-09-08.sha-d5666ea8
      @adobe/aio-cli-plugin-app 9.1.1
      @adobe/aio-cli-plugin-app-templates 1.2.0
      @adobe/aio-cli-plugin-auth 3.0.1
      @adobe/aio-cli-plugin-certificate 1.0.1
      @adobe/aio-cli-plugin-config 4.0.1
      @adobe/aio-cli-plugin-console 4.0.1
      @adobe/aio-cli-plugin-events 2.0.2
      @adobe/aio-cli-plugin-info 3.0.1
      @adobe/aio-cli-plugin-runtime 6.0.1
      @adobe/aio-cli-plugin-telemetry 1.0.2
      @oclif/plugin-autocomplete 1.3.0
      @oclif/plugin-help 5.1.12
      @oclif/plugin-not-found 2.3.1
      @oclif/plugin-plugins 2.1.0
      @oclif/plugin-warn-if-update-available 2.0.4
    user:
    link:

Logs taken while reproducing problem

serve-static
  yeoman:generator Queueing generator undefined with generator version 5.7.0
  yeoman:generator Queueing #initializing with options { priorityName: 'initializing', queueName: 'initializing', cancellable: true, run: false, auto: true, taskName: 'initializing' }
  yeoman:generator Queueing #writing with options { priorityName: 'writing', queueName: 'writing', cancellable: true, run: false, auto: true, taskName: 'writing' }
  yeoman:environment Queueing conflicts task
  yeoman:generator Running #initializing
✖ An error occured while running #initializing
  @adobe/aio-cli-plugin-app:runDev:error unexpected error, cleaning up...
  @adobe/aio-cli-plugin-app:cleanup:debug stopping action watcher...
  @adobe/aio-cli-plugin-app:actions-watcher:debug stopping action watcher...
  @adobe/aio-cli-plugin-app:error Error: Missing option for generator: frontend-url
  @adobe/aio-cli-plugin-app:error     at AddVsCodeConfig._processForFrontend (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@adobe/generator-aio-app/generators/add-vscode-config/index.js:217:13)
  @adobe/aio-cli-plugin-app:error     at AddVsCodeConfig.initializing (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@adobe/generator-aio-app/generators/add-vscode-config/index.js:245:12)
  @adobe/aio-cli-plugin-app:error     at Object.<anonymous> (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/yeoman-generator/lib/index.js:1091:23)
  @adobe/aio-cli-plugin-app:error     at /Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/run-async/index.js:49:25
  @adobe/aio-cli-plugin-app:error     at new Promise (<anonymous>)
  @adobe/aio-cli-plugin-app:error     at /Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/run-async/index.js:26:19
  @adobe/aio-cli-plugin-app:error     at /Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/yeoman-generator/lib/index.js:1092:9
  @adobe/aio-cli-plugin-app:error     at new Promise (<anonymous>)
  @adobe/aio-cli-plugin-app:error     at AddVsCodeConfig.executeTask (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/yeoman-generator/lib/index.js:1063:12)
  @adobe/aio-cli-plugin-app:error     at runLoop.add.once (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/yeoman-generator/lib/index.js:1043:14)
Error: Missing option for generator: frontend-url
    at Object.error (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@oclif/core/lib/errors/index.js:28:15)
    at Run.error (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@oclif/core/lib/command.js:104:23)
    at Run.handleError (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@adobe/aio-cli-plugin-app/src/BaseCommand.js:47:10)
    at Run.catch (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@adobe/aio-cli-plugin-app/src/BaseCommand.js:34:10)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Run._run (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@oclif/core/lib/command.js:85:13)
    at async Config.runCommand (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@oclif/core/lib/config/config.js:272:25)
    at async Object.run (/Users/jessem/.nvm/versions/node/v14.20.0/lib/node_modules/@adobe/aio-cli-next/node_modules/@oclif/core/lib/main.js:76:5)
@purplecabbage purplecabbage added the bug Something isn't working label Sep 17, 2022
@aiojbot
Copy link
Collaborator

aiojbot commented Sep 22, 2022

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-1786

@shazron shazron transferred this issue from adobe/aio-cli Oct 27, 2022
@shazron
Copy link
Member

shazron commented Oct 27, 2022

The naïve fix is not to generate the vscode config if frontEndUrl is empty but the user might want to debug backend actions as well.

The better fix is in generator-aio-app where based on the app config (app.hasFrontEnd) we either generate the launch configuration for Chrome debugging, or not.

So therefore we need to determine if the serve-static hook is set, is that effectively app.hasFrontEnd === false? The serve-static hook might serve a front end, but there is no way for our hook runner to know about the url. @purplecabbage thoughts?

@shazron shazron self-assigned this Oct 27, 2022
@MichaelGoberling
Copy link
Contributor

This may be naïve, but I figured if a developer has a hook for serve-static set then they want to modify the behavior of serving static assets, implying that there are static assets to serve? i.e app.hasFrontEnd === true

As an aside, looking at this diagram, would it be correct for us to skip this hook altogether if there are no static assets to serve?

@moritzraho
Copy link
Member

I +1 Michael's comment with an addition: console.log a warning that the hook will not be applied.
Actually the same approach should be taken for backend only hooks and so on

@purplecabbage
Copy link
Member Author

+1 what @MichaelGoberling and @moritzraho said

@shazron
Copy link
Member

shazron commented Oct 31, 2022

We are already skipping the hook if we don't have a front end, that is not the problem I am facing.

The problem is strictly if the serve-static hook is set, logically to the vscode config generator, there is no front end to configure for, since there is no way to know this info, thus app.hasFrontEnd (to the vscode config generator only) is effectively false.

@shazron
Copy link
Member

shazron commented Oct 31, 2022

Although we don't provide a warning when we skip it however

@MichaelGoberling
Copy link
Contributor

Sorry @shazron, my original answer was naïve. Looking at the diagram again, it seems serve-static will run in place of us serving static assets. Thus, we as the plugin won't be serving any static assets and it seems to us there is no front end. So I agree app.hasFrontEnd === false in this scenario.

If we wanted to support chrome debugging of custom-served web assets, we'd have to introduce a mechanism for hook implementers to return data, in this scenario a frontEndUrl, but that seems out of scope.

@shazron
Copy link
Member

shazron commented Nov 14, 2022

PR #617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants