Having an issue where any install of Bedrock causes failures for the REST API.
#### The REST API encountered an unexpected result Performance
The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.
When testing the REST API, an unexpected result was returned:
REST API Endpoint: http://xxxx.xxx/wp-json/wp/v2/types/post?context=edit
REST API Response: (500) Internal Server Error
This seems to boil down to permissions, as accessing the URL directly returns:
code "rest_forbidden_context"
message "Sorry, you are not allowed to edit posts in this post type."
data
status 401
Yeah, it’s a super strange bug. I’m not using SAGE (will test that shortly), I’m using a super barebones starter (basically just the required files (index.php, functions.php, styles.css .etc)
This is a fresh Bedrock install, so no API changes. Other standard WP installs work fine. It’s as though there is some disconnect between the connection - the fact it says I don’t have permission despite Super Admin privileges leads me to believe there is something happening there.
If navigating too quickly, a database connection error can occur, but only briefly - see below:
Yeah, I figured it could be a SQL issue. Too many connections etc. However, nothing makes it to the log (other than a self-signed SSL warning for another dev site)
--- on 2025-03-04 00:20
2025-03-04T00:20:14.593379Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-03-04T00:20:14.742880Z 0 [System] [MY-010116] [Server] c:\wamp64\bin\mysql\mysql8.3.0\bin\mysqld.exe (mysqld 8.3.0) starting as process 22584
2025-03-04T00:20:14.760835Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-03-04T00:20:14.961692Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-03-04T00:20:15.280914Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-03-04T00:20:15.281350Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-03-04T00:20:15.318598Z 0 [System] [MY-010931] [Server] c:\wamp64\bin\mysql\mysql8.3.0\bin\mysqld.exe: ready for connections. Version: '8.3.0' socket: '' port: 3306 MySQL Community Server - GPL.
Between this and your other posts, I’m starting to think something is weird with your environment. Have you considered modernizing with something like https://herd.laravel.com/? You can use the free version on Windows alongside https://dbngin.com/ for a decent setup.
Yes, that does seem to be the issue. Could not replicate the error/issue with Herd + Dbngin. This is a bit of a problem, though.
I find this environment considerably slower. Loads that typically occur in 0.10s in WAMP are taking about 2s+ in the recommended environment. I could need to tweak the environment, but a quick AI question returned:
WAMP installs Apache, MySQL, and PHP directly on your Windows machine, while Herd and DBngin involve additional layers like Docker (for Herd) and the external database manager (DBngin).
The extra layer of abstraction and the complexity of communication between components (e.g., between your web server, database, and PHP services) can slow things down.
WAMP runs these services directly on the OS, giving it faster access to system resources.
Outside of Valet Linux with WSL2, I don’t have a ton of suggestions for Windows development. I’m not really sure what with WAMP causes this issue to begin with.
Swapping WP_CONTENT_DIR for just '' got rid of the path concatenation issue. Now, this is more closely related to my other post, but at least it is progress.