sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Cannot GET /_layouts/workbench.aspx

Open duncanspeidel opened this issue 7 years ago • 17 comments

Category

  • [ ] Question
  • [ ] Typo
  • [ X] Bug
  • [ ] Additional article idea
  • [x] Example checked item (delete this line)

I am following the instructions on https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/connect-to-sharepoint. I am near the button of the page and it tells me to call https://localhost:4321/_layouts/workbench.aspx. This fails with: Cannot GET /_layouts/workbench.aspx

I am currently running with a local sharePoint created using gulp serve. My code runs on https://localhost:4321/temp/workbench.html, how do I access the referenced workbench?

Thank you, Duncan

duncanspeidel avatar Aug 09 '19 19:08 duncanspeidel

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Aug 09 '19 19:08 msft-github-bot

Thanks for the issue. Can you confirm the URL you are accessing?

The documentation states that you need to access: https://your-sharepoint-site-url/_layouts/workbench.aspx

The URL you provided was https://localhost:4321/_layouts/workbench.aspx

Please make sure you are referencing your SharePoint Site URL

bcameron1231 avatar Aug 09 '19 19:08 bcameron1231

If I go to my SharePoint server https://your-sharepoint-site-url/_layouts/workbench.aspx fails with web part not appearing because gulp serve is not running. See the screenshot for the full message sharePoint.

I am not running gulp serve on the sharePoint server, I am running it on my local development environment. On my local environment it reports Cannot GET /_layouts/workbench.aspx.

duncanspeidel avatar Aug 12 '19 17:08 duncanspeidel

You need to be running gulp serve on your local environment, because _layouts/15/workbench.aspx will load the files from your local node instance.

As per the documentation you linked and per the error...

  1. run gulp serve
  2. It will load your local workbench (workbench.html)
  3. Navigate to your hosted workbench https://yoursite.sharepoint.com/_layouts/workbench.aspx (keep gulp serve running)

bcameron1231 avatar Aug 12 '19 17:08 bcameron1231

I am running gulp serve on the local environment. On the console I see: Request: '/lib/webparts/helloWorld/loc/en-us.js' Request: '/dist/hello-world-web-part.js' Request: '/_layouts/workbench.aspx' but when I try to call the workbench it fails with: Cannot GET /_layouts/workbench.aspx.

duncanspeidel avatar Aug 12 '19 18:08 duncanspeidel

what is the full URL are you using when you call the workbench.

bcameron1231 avatar Aug 12 '19 18:08 bcameron1231

My local version I try to test with: https://localhost:4321/_layouts/workbench.aspx that fails with Cannot GET /_layouts/workbench.aspx. If I replace /localhost:4321 with my SharePoint server it gives the pop-up shown before.

duncanspeidel avatar Aug 12 '19 19:08 duncanspeidel

What happens if you try and access the bundle directly? localhost:4321/dist/hello-world-web-part.js?

bcameron1231 avatar Aug 12 '19 21:08 bcameron1231

Hi @duncanspeidel

run command before gulp serve >>> gulp trust-dev-cert

cesarhoeflich avatar Aug 13 '19 15:08 cesarhoeflich

I ran gulp trust-dev-cert before I called gulp serve. running localhost:4321/dist/hello-world-web-part.js dumps JS on the screen,

duncanspeidel avatar Aug 14 '19 17:08 duncanspeidel

That is strange that you can load the JS bundle... that means it's running correctly, it should be available from the workbench...

bcameron1231 avatar Aug 14 '19 19:08 bcameron1231

Hi @duncanspeidel, any chance you're targeting on-prem when going through the web part wizard? I'm having a similar issue #4485 and found a workaround if that's the case.

BassemNKhalil avatar Aug 16 '19 04:08 BassemNKhalil

Not targeting on prem, working local.

duncanspeidel avatar Aug 16 '19 13:08 duncanspeidel

How do I check?

duncanspeidel avatar Aug 16 '19 14:08 duncanspeidel

You can check the package.json file, it lists all project dependencies. I'm after the ones starting with @microsoft\ - mine (targeting SP16) is below.

"@microsoft/sp-build-web": "~1.1.0",
"@microsoft/sp-module-interfaces": "~1.1.0",
"@microsoft/sp-webpart-workbench": "~1.1.0",

BassemNKhalil avatar Aug 16 '19 22:08 BassemNKhalil

Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.

msft-github-bot avatar Aug 19 '19 23:08 msft-github-bot

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 23 '20 18:01 msft-github-bot