Problem
The Amplify Gen 2 overlay adds npm run blocks:dev, which starts the Blocks dev server on port 3001. However, the generated browser client always imports amplify_outputs.json and uses custom.blocks_api_url. That file is produced by ampx sandbox or a deployment, and its URL points at the deployed Blocks API.
As a result, starting blocks:dev does not change where browser API calls go. A customer can have a healthy local Blocks server while the frontend either cannot start because no outputs file exists, or continues to call the sandbox API. The integration CLI also states that the API is available at /api alongside the Amplify backend, although the overlay publishes the separate blocks.apiUrl in amplify_outputs.json.
Evidence
- The overlay starts
startDevServer(..., port: 3001) in aws-blocks/scripts/server.ts.
- The generated client resolves only
outputs.custom?.blocks_api_url and throws when it is absent.
- No overlay script or client configuration switches that URL to
http://localhost:3001/aws-blocks/api.
Decision needed
Please clarify which developer experience the Amplify integration should support:
- Local Blocks development: provide an explicit dev-mode client configuration that targets the local server, and document how auth behaves in that mode; or
- Sandbox-first development: remove or rename the misleading
blocks:dev command and document that ampx sandbox must be run before the frontend can call Blocks.
The first option is more useful for local-first iteration, but it needs an intentional approach to Cognito auth and to selecting the API URL. I am opening this before a PR because the right implementation depends on that product decision.
Related
Problem
The Amplify Gen 2 overlay adds
npm run blocks:dev, which starts the Blocks dev server on port 3001. However, the generated browser client always importsamplify_outputs.jsonand usescustom.blocks_api_url. That file is produced byampx sandboxor a deployment, and its URL points at the deployed Blocks API.As a result, starting
blocks:devdoes not change where browser API calls go. A customer can have a healthy local Blocks server while the frontend either cannot start because no outputs file exists, or continues to call the sandbox API. The integration CLI also states that the API is available at/apialongside the Amplify backend, although the overlay publishes the separateblocks.apiUrlinamplify_outputs.json.Evidence
startDevServer(..., port: 3001)inaws-blocks/scripts/server.ts.outputs.custom?.blocks_api_urland throws when it is absent.http://localhost:3001/aws-blocks/api.Decision needed
Please clarify which developer experience the Amplify integration should support:
blocks:devcommand and document thatampx sandboxmust be run before the frontend can call Blocks.The first option is more useful for local-first iteration, but it needs an intentional approach to Cognito auth and to selecting the API URL. I am opening this before a PR because the right implementation depends on that product decision.
Related