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

Issue: Local Development setup failed SfError: Error occurred downloading your site #205

Open
KaneBN opened this issue Oct 17, 2024 · 7 comments
Assignees
Labels

Comments

@KaneBN
Copy link

KaneBN commented Oct 17, 2024

Summary

Running into an issue attempting to run the local dev server for an LWR site in my scratch org.

Steps To Reproduce:

  1. run sf lightning dev site --name my_lwr_name in the cli

Expected Result

Local Dev spins up

Actual Result

Seems unable to download my LWR for an unknown reason, I've looked for more verbose logging in ~/.sf/ but could find no relevant info unfortunately

[local-dev] initializing: staff
[local-dev] Downloading site...
Local Development setup failed SfError: Error occurred downloading your site: my_lwr_name
    at ExperienceSite.downloadSite (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/lib/shared/experience/expSite.js:203:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LightningDevSite.run (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/lib/commands/lightning/dev/site.js:47:27)
    at async LightningDevSite._run (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/command.js:301:22)
    at async Config.runCommand (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:424:25)
    at async run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:95:16)
    at async file:///opt/homebrew/lib/node_modules/@salesforce/cli/bin/run.js:15:1 {
  actions: undefined,
  exitCode: 1,
  context: undefined,
  data: undefined,
  cause: undefined
}

System Information

Shell: Fish

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.62.6",
  "nodeVersion": "node-v20.11.1",
  "osVersion": "Darwin 24.0.0",
  "rootPath": "/opt/homebrew/lib/node_modules/@salesforce/cli",
  "shell": "fish",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.5 (core)",
    "@oclif/plugin-commands 4.1.3 (core)",
    "@oclif/plugin-help 6.2.14 (core)",
    "@oclif/plugin-not-found 3.2.22 (core)",
    "@oclif/plugin-plugins 5.4.14 (core)",
    "@oclif/plugin-search 1.2.11 (core)",
    "@oclif/plugin-update 4.6.3 (core)",
    "@oclif/plugin-version 2.2.14 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.18 (core)",
    "@oclif/plugin-which 3.2.15 (core)",
    "@salesforce/cli 2.62.6 (core)",
    "apex 3.5.1 (core)",
    "api 1.3.1 (core)",
    "auth 3.6.65 (core)",
    "community 3.0.16 (user) published 257 days ago (Sat Feb 03 2024) (latest is 3.2.35)",
    "data 3.7.0 (core)",
    "deploy-retrieve 3.12.17 (core)",
    "info 3.4.9 (core)",
    "lightning-dev 1.9.0 (user) published 6 days ago (Fri Oct 11 2024)",
    "limits 3.3.32 (core)",
    "marketplace 1.2.26 (core)",
    "org 4.6.0 (core)",
    "packaging 2.8.11 (core)",
    "schema 3.3.34 (core)",
    "settings 2.3.23 (core)",
    "sobject 1.4.41 (core)",
    "source 3.5.21 (core)",
    "telemetry 3.6.15 (core)",
    "templates 56.3.22 (core)",
    "trust 3.7.33 (core)",
    "user 3.5.32 (core)"
  ]
}

OS:
Apple M2 Pro MacOS version 15 Beta

@maliroteh-sf
Copy link
Contributor

maliroteh-sf commented Oct 17, 2024

@KaneBN not sure what the issue is but if you run the command like this DEBUG=* sf lightning dev site ... in your terminal then you will get a LOT more debug info printed out and that might shed some light on what's happening here.

@KaneBN
Copy link
Author

KaneBN commented Oct 17, 2024

@maliroteh-sf Thanks for the quick reply!

I've tried running the following commands but have received the same output as in the original issue description

DEBUG=* sf lightning dev site

DEBUG=* sf lightning dev site --name my_lwr_site

Am I supposed to replace the '*' with a debug log level?

I did also see this line in the readme NODE_OPTIONS="--inspect-brk" sf lightning dev site which interestingly gives me the following:

Debugger listening on ws://127.0.0.1:9229/1e7b0756-e168-44ae-9a1a-91b92d731729 For help, see: https://nodejs.org/en/docs/inspector

But then it doesn't seem to execute the command and just hangs there

@maliroteh-sf
Copy link
Contributor

@KaneBN You don't need to replace * with anything. DEBUG=* should cause lots of debug statements to be printed out as the command executes, so if this hasn't helped then we might have to take a different route to diagnosing this issue.

Looking at your original post, I see that the command you've executed is sf lightning dev site --name my_lwr_name

So is my_lwr_name actually the name of your site (that doesn't sound right at first glance)? I think you should be able to run the command and omit --name parameter (i.e just run sf lightning dev site) and it should provide you with a list of available sites in your org that you can choose from. This would be another way to ensure that you are picking the right site.

Note that you should install the most recent version of the plugin (v1.9.0 as of now) if you plan to omit --name when using the command since support for listing out the available sites and allowing the user to pick one was added recently.

@KaneBN
Copy link
Author

KaneBN commented Oct 18, 2024

@maliroteh-sf apologies, didn't realise last night that because I was using the fish shell the DEBUG=* wouldn't set the environment variable.

I've ran the same command in zsh and did get a slightly more verbose output, omitting the name parameter and simply selecting the name of the lwr:

  DEBUG=* sf lightning dev site
  sf:telemetry Usage acknowledgement file already exists +0ms
  sf:telemetry Using telemetry logging file /var/folders/r2/g5_fp9bd1mvcsgc680l_px2h0000gn/T/sf-telemetry/telemetry-6e349e30ef22b11f023c9504539bfac9f8be471d.log +1ms
  sf:telemetry Setting up process exit handler +243ms
  oclif:config reloading config from @oclif/[email protected] to @oclif/[email protected] +0ms
  oclif:config config done +13ms
  oclif:sf:lightning:dev:site init version: @oclif/[email protected] argv: [] +0ms
  oclif:config start preparse hook +1ms
  oclif:config:ts-path Skipping typescript path lookup for /opt/homebrew/lib/node_modules/@salesforce/cli because NODE_ENV is NOT "test" or "development" +0ms
  oclif:@salesforce/cli:hooks:preparse start (import) /opt/homebrew/lib/node_modules/@salesforce/cli/dist/hooks/preparse.js +0ms
  oclif:@salesforce/cli:hooks:preparse done +1ms
  oclif:config preparse hook done +3ms
? Select a site test
[local-dev] initializing: test
[local-dev] Downloading site...
Local Development setup failed SfError: Error occurred downloading your site: test
    at ExperienceSite.downloadSite (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/lib/shared/experience/expSite.js:203:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LightningDevSite.run (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/lib/commands/lightning/dev/site.js:47:27)
    at async LightningDevSite._run (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/command.js:301:22)
    at async Config.runCommand (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:424:25)
    at async run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:95:16)
    at async file:///opt/homebrew/lib/node_modules/@salesforce/cli/bin/run.js:15:1 {
  actions: undefined,
  exitCode: 1,
  context: undefined,
  data: undefined,
  cause: undefined
}
  sf:telemetry Spawning "/opt/homebrew/Cellar/node@20/20.11.1/bin/node /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-telemetry/processes/upload.js /Users/kane/Library/Caches/sf /var/folders/r2/g5_fp9bd1mvcsgc680l_px2h0000gn/T/sf-telemetry/telemetry-6e349e30ef22b11f023c9504539bfac9f8be471d.log" +4s

Having noticed the line mentioning supplying the NODE_ENV parameter, I set that with the full command being NODE_ENV=development DEBUG=* sf lightning dev site I got a bit more:

(node:48926) Error Plugin: @salesforce/cli: could not find package.json with {
  name: '@oclif/plugin-command-snapshot',
  root: '/opt/homebrew/lib/node_modules/@salesforce/cli',
  type: 'dev'
}
module: @oclif/[email protected]
plugin: @salesforce/cli
root: /opt/homebrew/lib/node_modules/@salesforce/cli
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
(node:48926) Error Plugin: @salesforce/cli: could not find package.json with {
  name: '@salesforce/plugin-release-management',
  root: '/opt/homebrew/lib/node_modules/@salesforce/cli',
  type: 'dev'
}
module: @oclif/[email protected]
plugin: @salesforce/cli
root: /opt/homebrew/lib/node_modules/@salesforce/cli
See more details with DEBUG=*
  sf:telemetry Usage acknowledgement file already exists +0ms
  sf:telemetry Using telemetry logging file /var/folders/r2/g5_fp9bd1mvcsgc680l_px2h0000gn/T/sf-telemetry/telemetry-ce7a95fd72f79a407ec29746aa2c481ef83ab38f.log +2ms
  sf:telemetry Setting up process exit handler +275ms
  oclif:config reloading config from @oclif/[email protected] to @oclif/[email protected] +0ms
  oclif:config config done +11ms
  oclif:sf:lightning:dev:site init version: @oclif/[email protected] argv: [] +0ms
  oclif:config start preparse hook +2ms
  oclif:read-tsconfig Error: ENOENT: no such file or directory, open '/opt/homebrew/lib/node_modules/@salesforce/cli/tsconfig.json' +0ms
  oclif:config:ts-path tsconfig: { compilerOptions: {}, 'ts-node': {} } +0ms
  oclif:config:ts-path Determining path for /opt/homebrew/lib/node_modules/@salesforce/cli/dist/hooks/preparse +0ms
  oclif:config:ts-path Could not find tsx. Skipping tsx registration for /opt/homebrew/lib/node_modules/@salesforce/cli. +0ms
  oclif:config:ts-path Error: Cannot find module 'tsx/esm/api'
  oclif:config:ts-path Require stack:
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/ts-path.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/help/index.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/errors/handle.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/errors/index.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/config.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/index.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/command.js
  oclif:config:ts-path - /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/index.js
  oclif:config:ts-path     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
  oclif:config:ts-path     at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@cspotcode/source-map-support/source-map-support.js:81
1:30)
  oclif:config:ts-path     at Function.resolve (node:internal/modules/helpers:187:19)
  oclif:config:ts-path     at registerTsx (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/ts-path.js:88:33)
  oclif:config:ts-path     at determinePath (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/ts-path.js:207:15)
  oclif:config:ts-path     at async tsPath (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/ts-path.js:285:16)
  oclif:config:ts-path     at async /Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/config.js:487:100
  oclif:config:ts-path     at async Promise.all (index 0)
  oclif:config:ts-path     at async Config.runHook (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/config/config.js:526:9)
  oclif:config:ts-path     at async LightningDevSite.parse (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/command.js:236:28) +0ms
  oclif:config:ts-path registering ts-node at /opt/homebrew/lib/node_modules/@salesforce/cli +1ms
  oclif:config:ts-path ts-node path: /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/ts-node/dist/index.js +0ms
  oclif:config:ts-path Successfully required ts-node +0ms
  oclif:config:ts-path ts-node options: {
  oclif:config:ts-path   compilerOptions: {
  oclif:config:ts-path     rootDirs: [ '/opt/homebrew/lib/node_modules/@salesforce/cli/src' ],
  oclif:config:ts-path     typeRoots: [
  oclif:config:ts-path       '/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@types'
  oclif:config:ts-path     ]
  oclif:config:ts-path   },
  oclif:config:ts-path   cwd: '/opt/homebrew/lib/node_modules/@salesforce/cli',
  oclif:config:ts-path   esm: true,
  oclif:config:ts-path   experimentalSpecifierResolution: 'explicit',
  oclif:config:ts-path   scope: true,
  oclif:config:ts-path   scopeDir: '/opt/homebrew/lib/node_modules/@salesforce/cli',
  oclif:config:ts-path   skipProject: true,
  oclif:config:ts-path   transpileOnly: true
  oclif:config:ts-path } +0ms
oclif:config:ts-path Error: Cannot find module '@jridgewell/trace-mapping'
  oclif:config:ts-path Require stack:
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@cspotcode/source-map-support/source-map-support.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/ts-node/dist/index.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/ts-path.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/help/index.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/errors/handle.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/errors/index.js
  oclif:config:ts-path - /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/execute.js
  oclif:config:ts-path     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
  oclif:config:ts-path     at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
  oclif:config:ts-path     at Function.Module._load (node:internal/modules/cjs/loader:985:27)
  oclif:config:ts-path     at Module.require (node:internal/modules/cjs/loader:1235:19)
  oclif:config:ts-path     at require (node:internal/modules/helpers:176:18)
  oclif:config:ts-path     at Object.<anonymous> (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@cspotcode/source-map-support/source-map-support.js:1:51)
  oclif:config:ts-path     at Module._compile (node:internal/modules/cjs/loader:1376:14)
  oclif:config:ts-path     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
  oclif:config:ts-path     at Object.require.extensions.<computed> [as .js] (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/ts-node/src/index.ts:1608:43)
  oclif:config:ts-path     at Module.load (node:internal/modules/cjs/loader:1207:32) +3ms
  oclif:@salesforce/cli:hooks:preparse start (import) /opt/homebrew/lib/node_modules/@salesforce/cli/dist/hooks/preparse.js +0ms
  oclif:@salesforce/cli:hooks:preparse done +0ms
  oclif:config preparse hook done +7ms
? Select a site test
[local-dev] initializing: test
[local-dev] Downloading site...
Local Development setup failed SfError: Error occurred downloading your site: test
    at ExperienceSite.downloadSite (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/src/shared/experience/expSite.ts:246:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async LightningDevSite.run (file:///Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/src/commands/lightning/dev/site.ts:56:19)
    at async LightningDevSite._run (/Users/kane/.local/share/sf/node_modules/@salesforce/plugin-lightning-dev/node_modules/@oclif/core/lib/command.js:301:22)
    at async Config.runCommand (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:424:25)
    at async run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:95:16)
    at async file:///opt/homebrew/lib/node_modules/@salesforce/cli/bin/run.js:15:1 {
  actions: undefined,
  exitCode: 1,
  context: undefined,
  data: undefined,
  cause: undefined
}
  sf:telemetry Spawning "/opt/homebrew/Cellar/node@20/20.11.1/bin/node /opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-telemetry/processes/upload.js /Users/kane/Library/Caches/sf /var/folders/r2/g5_fp9bd1mvcsgc680l_px2h0000gn/T/sf-telemetry/telemetry-ce7a95fd72f79a407ec29746aa2c481ef83ab38f.log" +4s

Interestingly though it does still say 'See more details with DEBUG=*' near the top of the output

@KaneBN
Copy link
Author

KaneBN commented Oct 18, 2024

After spinning up a fresh empty Build Your Own LWR template and publishing it looks like the generated MRT bundle size exceeds the static resource file size limit specified in the docs, does this process pull in all static resources in the org? Could be why it's not happy with the download

MRT_experience_00DPt000003QAoP_0DMPt00000041Tm_test | Bnow | MRT bundle for site test | application/x-gzip | 8,816,960 | UUser | 18/10/2024 | 18/10/2024, 09:55

@maliroteh-sf
Copy link
Contributor

I'll have to delegate to @nrkruk on this.

@nrkruk nrkruk self-assigned this Oct 23, 2024
@nrkruk nrkruk added the BUG P2 label Oct 23, 2024
Copy link

git2gus bot commented Oct 23, 2024

This issue has been linked to a new work item: W-17046381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants