Skip to content

can't set Cloudflare static assets "not-found-handling" config parameter #5947

@WayneBuckhanan

Description

@WayneBuckhanan

I just saw that the Cloudflare Worker SST component can deploy assets and ran a test with static files and a small hono script. The hono part worked fine, but it always ran and none of the static files were being served. Realized it was the "not-found-handling": "single-page-application" parameter usually passed to assets in the wrangler config file, so dug through the Pulumi layers to figure out the transform.

  async run() {
    const worker = new sst.cloudflare.Worker("Workit", {
      handler: "./index.ts",
      url: true,
      assets: {
        directory: "./dist",
      },
      transform: {
        worker: {
          assets: {
            config: {
              notFoundHandling: "single-page-application",
            },
          },
        },
      },
    })

✕ Failed

Workit sst:cloudflare:Worker → WorkitScript cloudflare:index:WorkersScript
[AttributeName("assets").AttributeName("config")] Value Conversion Error: An unexpected error was encountered trying to convert tftypes.Value into workers_script.WorkersScriptMetadataAssetsConfigModel. This is always an error in the provider. Please report the following to the provider developer:
error retrieving field names from struct tags: assets.config._headers: invalid tfsdk tag, must only use lowercase letters, underscores, and numbers, and must start with a letter

Seems to be related to the tf bug @fwang is aware of, but wanted to get this in here as another case to test when the upstream issue is resolved.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions