Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

huangapple go评论77阅读模式
英文:

Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

问题

警告:已弃用环境变量:SFDX_JSON_TO_STDOUT。请改用SF_JSON_TO_STDOUT。
(使用 node --trace-warnings ... 显示警告的创建位置)
警告:已弃用“force org open”命令。请改用“org open”。
错误(1):仅支持绝对URL
14:52:35.666 sfdx force:org:open
以退出码1结束
在VS Code中使用sfdx:open默认组织时,我遇到了上述错误,请帮我解决这个问题?

尝试打开我的默认Salesforce开发组织,但未能成功。

英文:

Warning: Deprecated environment variable: SFDX_JSON_TO_STDOUT. Please use SF_JSON_TO_STDOUT instead.
(Use node --trace-warnings ... to show where the warning was created)
Warning: The "force org open" command has been deprecated. Use "org open" instead.
Error (1): Only absolute URLs are supported
14:52:35.666 sfdx force:org:open
ended with exit code 1
While using sfdx:open default org in the VS code I am getting the above error please help me out of this?

Trying to open my default salesforce development org but failed to do so.

答案1

得分: 3

我做了相同的事情,只需尝试这个命令:

sfdx org:login:web --instance-url [你的URL]

您可以通过点击右上角的“查看个人资料”按钮来找到正确的URL,如下图所示:
Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

英文:

I did the same thing, just try this command:

sfdx org:login:web --instance-url [your url]

You can find the correct url by clicking on View Profile button (top right) as in the following figure:

Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

答案2

得分: 3

None of those solution worked for me. I suspect that migration from enhanced domain caused the issue. To solve the issue, I log out from vs code using the following sfdx command:

sfdx auth:logout

Then after that, I reauthenticate to my org. Then after that I had to close my vs code and restart it. If I do not close my vs code, the error where persisting.
After that, It worked well.

英文:

None of those solution worked for me. I suspect that migration from enhanced domain caused the issue. To solve the issue, I log out from vs code using the following sfdx command :

sfdx auth:logout

Then after that , I reauthenticate to my org. Then after that I had to close my vs code and restart it. If I do not close my vs code , the error where persisting.
After that, It worked well.

答案3

得分: 2

尝试重新授权该组织。在终端上使用以下命令:

sfdx org:login:web --instance-url [你的网址]

不要添加 'www',应该是 https://yourdomain.salesforce.com

英文:

Try to reauthorize the org. Use the following command on the terminal:

sfdx org:login:web --instance-url [your url]

do not add 'www' should just be https://yourdomain.salesforce.com

答案4

得分: 1

执行通常的“SFDX: 授权组织”命令,从VsCode命令面板中执行,然后关闭并重新打开Vscode会解决此问题。

英文:

Running the usual, "SFDX: Authorize an Org", command from the VsCode Command Palette, then closing and re-opening Vscode fixes this issue.

答案5

得分: 0

我尝试更新 sfdx-project.json 文件,并且它奏效:

旧的:

{
  "packageDirectories": [
    { 
    "path": "force-app"
    }
  ],
  "name": "SelfMainOrg",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "57.0"
}

新的:

{
  "packageDirectories": [
    { "path": "force-app", "default": true },
	 
    { "path" : "manifest" }
  ],
  "name": "SelfMainOrg",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "57.0"
}

总结一下,我添加了 Manifest 的路径。技术上,当我通过选择文件并单击 "将源代码部署到组织" 来检索或部署单个文件时,添加 Manifest 路径是无关紧要的。但不知何故,它对我起作用。

英文:

I tried updating sfdx-project.json file and it worked:
Old:

{
  "packageDirectories": [
    { 
    "path": "force-app"
    }
  ],
  "name": "SelfMainOrg",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "57.0"
}

New:

{
  "packageDirectories": [
    { "path": "force-app", "default": true },
	 
    { "path" : "manifest" }
  ],
  "name": "SelfMainOrg",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "57.0"
}

In Summary I added path for Manifest. Technically as I was retrieving or deploying a Single file by selecting it and clicking on "Deploy Source to Org", adding Manifest path is irrelevant. But somehow it did work for me.

答案6

得分: 0

我最近安装了sf并删除了sfdx,但仍然遇到了相同的问题。以下是我解决问题的方法:

使用以下命令删除未能正常工作的别名:

sf org logout --target-org [alias] --no-prompt

然后,我进行了组织的授权,但不是通过命令,而是通过点击来完成。这种方式对我有效,我必须使用以下步骤进行:

  1. 按下 Ctrl + Shift + P
  2. 选择 SFDX: Authorize an Org
  3. 选择 Custom
  4. 添加增强型URL,格式如下:https://mycompany--dev.sandbox.my.salesforce.com

Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code
Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

英文:

I recently installed sf and removed sfdx and I was having the same problem. Here is how I solved it:

Delete the alias that wasn't working with this command:

> sf org logout --target-org [alias] --no-prompt

Then I authorized an Org but not with commands, that way it didn't work out for me, I had to do it with clicks:

  1. Ctrl + Shift + P
  2. SFDX: Authorize an Org
  3. Select Custom
    Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code
  4. Add the enhanced URL with this format: https://mycompany--dev.sandbox.my.salesforce.com
    Getting an "Only absolute URLs" error while trying to open Salesforce org with sfdx:open in VS Code

huangapple
  • 本文由 发表于 2023年6月1日 17:52:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76380679.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定