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

[bug]: upwardPath not found error #4352

Open
1 of 8 tasks
zeina99 opened this issue Nov 17, 2024 · 1 comment
Open
1 of 8 tasks

[bug]: upwardPath not found error #4352

zeina99 opened this issue Nov 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@zeina99
Copy link

zeina99 commented Nov 17, 2024

Describe the bug

Whenever trying to launch an upward-js server using the command npx upward-js-server I get an error saying the following:

Error: upwardPath is required
    at createUpwardServer (/home/pwa/node_modules/@magento/upward-js/lib/createUpwardServer.js:47:15)
    at Object.<anonymous> (/home/pwa/node_modules/@magento/upward-js/bin/server:5:40)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

I have already provided the required environment variables in the .env file
UPWARD_JS_UPWARD_PATH=dist/upward.yml
UPWARD_JS_BIND_LOCAL=true

To reproduce

Steps to reproduce the behavior:

  1. Create a sample pwa project
  2. Setup upward-js variables in the .env file
  3. Launch the upward-js server using the command npx upward-js-server
  4. Error saying upwardPath is required will show up.

Expected behavior

I expect the upward js server to launch given that the env variables are provided.

Screenshots

If applicable, add screenshots to help explain your problem.

Possible solutions

I did try to debug the issue and check that .env variables set in the file are being read.
In the file /bin/server I added a console.log(config); and this was the output:

[Function: transformer] {
  fromEnv: [Function (anonymous)],
  toEnv: [Function (anonymous)]
}

And this is not the input createUpwardServer() expects in createUpwardServer.js
After manually editing the config object to be

const config = {
    upwardPath: process.env.UPWARD_JS_UPWARD_PATH || './upward.yml',
    bindLocal: process.env.UPWARD_JS_BIND_LOCAL === 'true',
    port: 8000),
    host:  '0.0.0.0',
    logUrl: true
};

Running npx upward-js-server worked!

Debug Report

yarn run v1.22.22
$ buildpack generate-build-report
  ℹ  Generating build report for [email protected]. This may take a moment.

  ℹ  Inspecting Dependencies
    Found 10 @magento dependencies in yarn.lock
    @magento/pwa-buildpack @ 11.4.3
    @magento/upward-js @ 5.3.2
    @adobe/apollo-link-mutation-queue @ 1.0.2
    @magento/babel-preset-peregrine @ 1.2.2
    @magento/eslint-config @ 1.5.3
    @magento/pagebuilder @ 8.2.1
    @magento/peregrine @ 13.2.1
    @magento/pwa-theme-venia @ 1.4.0
    @magento/upward-security-headers @ 1.0.11
    @magento/venia-ui @ 10.3.0

  ℹ  Inspecting Magento Backend
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Intercept custom JS done
Intercept custom CSS done
    Not using sample backend.
    Backend is UP!

  ℹ  Inspecting System
    OS: #78~20.04.1-Ubuntu SMP Wed Oct 9 22:05:22 UTC 2024
    Node Version: v16.18.1
    NPM Version: 8.19.2

Please complete the following device information:

  • Device [e.g. iPhone6, PC, Mac, Pixel3]:
  • Browser [e.g. Chrome, Safari]:
  • Browser Version [e.g. 22]:
  • Magento Version [e.g Adobe Commerce 2.4]:

Please let us know what packages this bug is in regards to:

  • venia-concept
  • venia-ui
  • pwa-buildpack
  • peregrine
  • pwa-devdocs
  • upward-js
  • upward-spec
  • create-pwa
@zeina99 zeina99 added the bug Something isn't working label Nov 17, 2024
Copy link

m2-assistant bot commented Nov 17, 2024

Hi @zeina99. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

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

No branches or pull requests

1 participant