adobe / adobe/helix-deploy-plugin-edge

Replace deprecated Dictionary with ConfigStore and SecretStore in context.env

Open
#80 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Background

PR #77 introduced unified environment/geo/device APIs. Comment https://github.com/adobe/helix-deploy-plugin-edge/pull/77#issuecomment-3554569809 identified that `context.env` uses the deprecated `Dictionary` API.

## Current Implementation

[src/template/fastly-adapter.js:74](https://github.com/adobe/helix-deploy-plugin-edge/blob/main/src/template/fastly-adapter.js#L74) creates `context.env` using:

```javascript
context.env: new Proxy(new Dictionary('secrets'), {
get: (target, prop) => {
try {
return target.get(prop);
} catch {
// fallback to package params fetch
}
}
})
```

## Required Changes

Replace `Dictionary` with modern Fastly APIs:

**For secrets:**
```javascript
import { SecretStore } from 'fastly:secret-store';
const secrets = new SecretStore('secrets');
const value = await secrets.get('key');
const plaintext = value.plaintext();
```

**For config:**
```javascript
import { ConfigStore } from 'fastly:config-store';
const config = new ConfigStore('config');
const value = config.get('key');
```

## Implementation Notes

- `SecretStore.get()` is async, returns object with `plaintext()` method
- `ConfigStore.get()` is sync, returns string directly
- Update Proxy handler to handle async secret retrieval
- Both require resource link names matching Fastly service config
- Only available during request processing, not at build-time

## References

- https://js-compute-reference-docs.edgecompute.app/docs/fastly:secret-store/SecretStore/
- https://js-compute-reference-docs.edgecompute.app/docs/fastly:config-store/ConfigStore/
- [docs/api-unification/environment-geo.md](https://github.com/adobe/helix-deploy-plugin-edge/blob/compat/docs/api-unification/environment-geo.md)

Contributor guide

Open the contributing guide

Research direction

Start in src/template/fastly-adapter.js around line 74 and read the linked environment/geo API documentation. Check the Fastly SecretStore and ConfigStore references to understand their async and sync behavior, then run the existing tests for the adapter and context.env. Done means context.env no longer uses Dictionary and both secret and config lookups work with the documented resource links.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cloud
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.