Skip to content

Amplify integration: define a usable local Blocks development workflow #579

Description

@ikenyal

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:

  1. Local Blocks development: provide an explicit dev-mode client configuration that targets the local server, and document how auth behaves in that mode; or
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions