Cannot GET /_layouts/workbench.aspx
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
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
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
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
.
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.
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...
- run gulp serve
- It will load your local workbench (workbench.html)
- Navigate to your hosted workbench https://yoursite.sharepoint.com/_layouts/workbench.aspx (keep gulp serve running)
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.
what is the full URL are you using when you call the workbench.
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.
What happens if you try and access the bundle directly? localhost:4321/dist/hello-world-web-part.js?
Hi @duncanspeidel
run command before gulp serve >>> gulp trust-dev-cert
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,
That is strange that you can load the JS bundle... that means it's running correctly, it should be available from the workbench...
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.
Not targeting on prem, working local.
How do I check?
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",
Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.
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