@fastly/compute-js-static-publish 8.0.0-rc.1 → 8.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAyHA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAikBhD"}
1
+ {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAyHA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAqkBhD"}
@@ -502,7 +502,11 @@ export async function action(actionArgs) {
502
502
  autoIndex: [],
503
503
  });
504
504
  let publicDirPrefix = server.publicDirPrefix;
505
- console.log(` ✔️ Server public dir prefix '${publicDirPrefix}'.`);
505
+ if (publicDirPrefix !== '') {
506
+ console.log(` ✔️ Server public dir prefix '${publicDirPrefix}'.`);
507
+ console.log(` ⚠️ Warning: server.publicDirPrefix is deprecated, and a future version will remove it.`);
508
+ console.log(` * To stop using it, see https://github.com/fastly/compute-js-static-publish/blob/main/MIGRATING.md`);
509
+ }
506
510
  let staticItems = server.staticItems;
507
511
  let allowedEncodings = server.allowedEncodings;
508
512
  let spaFile = server.spaFile;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/index.ts"],"names":[],"mappings":"AAuEA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,GAAG,EAAE,MAAM,GAAG,SAA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S,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AA0TF,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA6rBhD"}
@@ -50,7 +50,7 @@ Compute Service Metadata:
50
50
  --service-id <id> (optional) Fastly service ID
51
51
 
52
52
  Server Config:
53
- --public-dir <path> Base dir for content (default: root-dir)
53
+ --public-dir <path> Deprecated. Base dir for content (default: root-dir)
54
54
  --static-dir <path>,<path...> Directory served with long TTL (can repeat)
55
55
  --spa <file> SPA fallback file (e.g., /index.html)
56
56
  --not-found-page <file> 404 fallback file (e.g., /404.html)
@@ -440,6 +440,10 @@ export async function action(actionArgs) {
440
440
  process.exitCode = 1;
441
441
  return;
442
442
  }
443
+ if (options.publicDir != null) {
444
+ console.log(`⚠️ Warning: --public-dir is deprecated, and a future version will remove it.`);
445
+ console.log(` * Use only --root-dir. Requests then map to the files under --root-dir.`);
446
+ }
443
447
  // Resolve the public dir as well. If it's not specified, we use the root directory.
444
448
  const PUBLIC_DIR = options.publicDir ?? ROOT_DIR;
445
449
  const publicDir = path.resolve(PUBLIC_DIR);
@@ -738,10 +742,10 @@ port = 443
738
742
  [setup.secret_stores]
739
743
  [setup.secret_stores.S3_CREDENTIALS]
740
744
  description = "Credentials for S3 storage"
741
- [setup.secret_stores.S3_CREDENTIALS.items]
742
- [setup.secret_stores.S3_CREDENTIALS.items.S3_ACCESS_KEY_ID]
745
+ [setup.secret_stores.S3_CREDENTIALS.entries]
746
+ [setup.secret_stores.S3_CREDENTIALS.entries.S3_ACCESS_KEY_ID]
743
747
  description = "Access Key ID"
744
- [setup.secret_stores.S3_CREDENTIALS.items.S3_SECRET_ACCESS_KEY]
748
+ [setup.secret_stores.S3_CREDENTIALS.entries.S3_SECRET_ACCESS_KEY]
745
749
  description = "Secret Access Key"
746
750
  `;
747
751
  }
@@ -808,7 +812,7 @@ export default rc;
808
812
  // We've already established publicDir.startsWith(rootDir)
809
813
  let publicDirPrefix = '';
810
814
  if (rootDir !== publicDir) {
811
- publicDirPrefix = rootDir.slice(rootDir.length);
815
+ publicDirPrefix = publicDir.slice(rootDir.length);
812
816
  }
813
817
  // staticItems - specified as prefixes, relative to publicDir
814
818
  const staticItems = [];
@@ -856,8 +860,8 @@ const config = {
856
860
  // ],
857
861
 
858
862
  // Server settings are saved to storage per collection
859
- server: {
860
- publicDirPrefix: ${JSON.stringify(publicDirPrefix)},
863
+ server: {${publicDirPrefix !== '' ? `
864
+ publicDirPrefix: ${JSON.stringify(publicDirPrefix)},` : ''}
861
865
  staticItems: ${JSON.stringify(staticItems)},
862
866
  allowedEncodings: [ 'br', 'gzip' ],
863
867
  spaFile: ${JSON.stringify(spaFile)},
@@ -918,8 +922,8 @@ To run your Compute application locally:
918
922
  To build and deploy to your Compute service:
919
923
 
920
924
  cd ${COMPUTE_JS_DIR}
925
+ npm run fastly:deploy
921
926
  npm run fastly:publish
922
- npm run fastly:start
923
927
 
924
928
  `);
925
929
  }
@@ -944,13 +948,28 @@ To run your Compute application locally
944
948
 
945
949
  To build and deploy to your Compute service:
946
950
 
947
- Create a Secret Store in your account named S3_CREDENTIALS, and set the following values:
948
- S3_ACCESS_KEY_ID: xxxx
949
- S3_SECRET_ACCESS_KEY: xxxx
950
-
951
+ The application reads the S3 credentials from the Secret Store that has the resource
952
+ link name 'S3_CREDENTIALS' on the service. The Secret Store can have a different name.
953
+
954
+ To deploy to an existing service, do these steps first:
955
+ 1. Create a Secret Store with the values 'S3_ACCESS_KEY_ID' and 'S3_SECRET_ACCESS_KEY'.
956
+ Give it a name that tells what it is for.
957
+ 2. Link the Secret Store to the service, with the resource link name 'S3_CREDENTIALS'.
958
+ If the service already has a link with this name, make sure that it points to
959
+ this Secret Store.
960
+
951
961
  Run the following commands:
952
962
  cd ${COMPUTE_JS_DIR}
953
- npm run fastly:start
963
+ npm run fastly:deploy
964
+
965
+ When the Fastly CLI creates a new service, it creates a Secret Store named
966
+ 'S3_CREDENTIALS', links it to the service with the same name, and prompts you for
967
+ the values 'S3_ACCESS_KEY_ID' and 'S3_SECRET_ACCESS_KEY'.
968
+
969
+ If a Secret Store named 'S3_CREDENTIALS' already exists, the Fastly CLI asks for a
970
+ different name. If you leave it empty, it uses the existing Secret Store. If you give
971
+ a different name, the Fastly CLI uses it for the resource link too. Then call
972
+ setSecretStoreForS3Credentials() with that name in src/index.js, and deploy again.
954
973
 
955
974
  `);
956
975
  }
@@ -1,5 +1,6 @@
1
1
  import { type ContentCompressionTypes } from '../compression/index.js';
2
2
  export type PublisherServerConfig = {
3
+ /** @deprecated A future version will remove this setting. */
3
4
  publicDirPrefix?: string;
4
5
  staticItems?: string[] | string | false | null;
5
6
  allowedEncodings?: ContentCompressionTypes[];
@@ -1 +1 @@
1
- {"version":3,"file":"publisher-server-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/publisher-server-config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAGvE,MAAM,MAAM,qBAAqB,GAAG;IAGlC,eAAe,CAAC,EAAE,MAAM,CAAC;IAQzB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAK/C,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAI7C,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIhC,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIzC,OAAO,CAAC,EAAE,MAAM,EAAE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AAuB,EAAE,CAAC;IAC5C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { type ContentCompressionTypes } from '../compression/index.js';
2
2
  export type PublisherServerConfig = {
3
+ /** @deprecated A future version will remove this setting. */
3
4
  publicDirPrefix?: string;
4
5
  staticItems?: string[] | string | false | null;
5
6
  allowedEncodings?: ContentCompressionTypes[];
@@ -1 +1 @@
1
- {"version":3,"file":"publisher-server-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/publisher-server-config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAGvE,MAAM,MAAM,qBAAqB,GAAG;IAGlC,eAAe,CAAC,EAAE,MAAM,CAAC;IAQzB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAK/C,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAI7C,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIhC,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIzC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAI3C,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;IAC5C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"publisher-server-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/publisher-server-config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAGvE,MAAM,MAAM,qBAAqB,GAAG;IAGlC,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IAQzB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAK/C,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAI7C,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIhC,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIzC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAI3C,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;IAC5C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"from-cookie.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selector/from-cookie.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,wBAAyB,YAAW,6BAA6B;;gBAEzD,UAAU,EAAE,MAAM;gBAClB,IAAI,EAAE,OAAO,CAAC,4BAA4B,CAAC;IAqBvD,IAAI,EAAE,4BAA4B,CAAC;IAEnC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,4BAA4B;IAIjE,aAAa,CAAC,OAAO,EAAE,OAAO;CA+DtC;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,4BAA4B,CAAC;IAC7C,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,4BAA4B,GAAG,gBAAgB,CAevH"}
1
+ {"version":3,"file":"from-cookie.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selector/from-cookie.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EACnC,MAAM,kCAAkC,CAAC;AAyB1C,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,wBAAyB,YAAW,6BAA6B;;gBAEzD,UAAU,EAAE,MAAM;gBAClB,IAAI,EAAE,OAAO,CAAC,4BAA4B,CAAC;IAqBvD,IAAI,EAAE,4BAA4B,CAAC;IAEnC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,4BAA4B;IAIjE,aAAa,CAAC,OAAO,EAAE,OAAO;CAmEtC;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,4BAA4B,CAAC;IAC7C,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,4BAA4B,GAAG,gBAAgB,CAevH"}
@@ -3,6 +3,28 @@
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
5
  import { getCookieValue } from '../util/cookies.js';
6
+ // The characters that a cookie value can have (cookie-octet in RFC 6265):
7
+ // no controls, spaces, '"', ',', ';', or '\'.
8
+ const COOKIE_VALUE_PATTERN = /^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/;
9
+ // The redirect target after activate or reset. Only a path on the same site
10
+ // is allowed; anything else gives '/'.
11
+ function getRedirectTo(url) {
12
+ const redirectTo = url.searchParams.get('redirectTo');
13
+ if (redirectTo == null || !redirectTo.startsWith('/') || redirectTo.startsWith('//') || redirectTo.startsWith('/\\')) {
14
+ return '/';
15
+ }
16
+ let target;
17
+ try {
18
+ target = new URL(redirectTo, url.origin);
19
+ }
20
+ catch {
21
+ return '/';
22
+ }
23
+ if (target.origin !== url.origin) {
24
+ return '/';
25
+ }
26
+ return target.pathname + target.search + target.hash;
27
+ }
6
28
  export class CookieCollectionSelector {
7
29
  constructor(optsOrCookieName) {
8
30
  let opts = optsOrCookieName;
@@ -33,7 +55,11 @@ export class CookieCollectionSelector {
33
55
  if (collectionName == null) {
34
56
  return new Response(`Missing required 'collection' query parameter.`, { status: 400 });
35
57
  }
36
- const redirectTo = url.searchParams.get('redirectTo') ?? '/';
58
+ // The value goes into Set-Cookie, so it must be a valid cookie value.
59
+ if (!COOKIE_VALUE_PATTERN.test(collectionName)) {
60
+ return new Response(`The 'collection' query parameter has characters that are not allowed.`, { status: 400 });
61
+ }
62
+ const redirectTo = getRedirectTo(url);
37
63
  const cookieSegments = [
38
64
  `${this.opts.cookieName}=${collectionName}`,
39
65
  ];
@@ -57,7 +83,7 @@ export class CookieCollectionSelector {
57
83
  });
58
84
  }
59
85
  if (url.pathname === this.opts.resetPath) {
60
- const redirectTo = url.searchParams.get('redirectTo') ?? '/';
86
+ const redirectTo = getRedirectTo(url);
61
87
  const cookieSegments = [
62
88
  `${this.opts.cookieName}=`,
63
89
  ];
@@ -5,7 +5,12 @@ export type S3Credentials = {
5
5
  };
6
6
  export type S3CredentialsBuilder = () => (S3Credentials | Promise<S3Credentials>);
7
7
  export declare const buildStoreProvider: StorageProviderBuilder;
8
- export declare function setSecretStoreForS3Credentials(secretStoreName: string): void;
8
+ /**
9
+ * Sets the resource link name of the Secret Store that has the S3 credentials.
10
+ * This is the name of the link between the service and the Secret Store, not
11
+ * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
12
+ */
13
+ export declare function setSecretStoreForS3Credentials(resourceLinkName: string): void;
9
14
  export declare function setSecretStoreKeyForS3AccessKeyId(secretStoreKey: string): void;
10
15
  export declare function setSecretStoreKeyForS3SecretAccessKey(secretStoreKey: string): void;
11
16
  export declare function buildS3CredentialsFromSecretStore(): Promise<S3Credentials>;
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/server/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,aAAa,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= (config) => {
19
19
  s3FastlyBackendName: s3StorageConfig.fastlyBackendName,
20
20
  });
21
21
  };
22
- let _secretStoreForS3Credentials = 'S3_CREDENTIALS';
22
+ let _secretStoreLinkNameForS3Credentials = 'S3_CREDENTIALS';
23
23
  let _secretStoreKeyForS3AccessKeyId = 'S3_ACCESS_KEY_ID';
24
24
  let _secretStoreKeyForS3SecretAccessKey = 'S3_SECRET_ACCESS_KEY';
25
- export function setSecretStoreForS3Credentials(secretStoreName) {
26
- _secretStoreForS3Credentials = secretStoreName;
25
+ /**
26
+ * Sets the resource link name of the Secret Store that has the S3 credentials.
27
+ * This is the name of the link between the service and the Secret Store, not
28
+ * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
29
+ */
30
+ export function setSecretStoreForS3Credentials(resourceLinkName) {
31
+ _secretStoreLinkNameForS3Credentials = resourceLinkName;
27
32
  }
28
33
  export function setSecretStoreKeyForS3AccessKeyId(secretStoreKey) {
29
34
  _secretStoreKeyForS3AccessKeyId = secretStoreKey;
@@ -38,19 +43,19 @@ export async function buildS3CredentialsFromSecretStore() {
38
43
  }
39
44
  let secretStore;
40
45
  try {
41
- secretStore = new SecretStore(_secretStoreForS3Credentials);
46
+ secretStore = new SecretStore(_secretStoreLinkNameForS3Credentials);
42
47
  }
43
48
  catch {
44
- throw new Error(`Could not open secret store for S3 credentials: ${_secretStoreForS3Credentials}`);
49
+ throw new Error(`Could not open the secret store for S3 credentials with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
45
50
  }
46
51
  const accessKeyIdEntry = await secretStore.get(_secretStoreKeyForS3AccessKeyId);
47
52
  if (accessKeyIdEntry == null) {
48
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in secret store '${_secretStoreForS3Credentials}'`);
53
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
49
54
  }
50
55
  const accessKeyId = accessKeyIdEntry.plaintext();
51
56
  const secretAccessKeyEntry = await secretStore.get(_secretStoreKeyForS3SecretAccessKey);
52
57
  if (secretAccessKeyEntry == null) {
53
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in secret store '${_secretStoreForS3Credentials}'`);
58
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
54
59
  }
55
60
  const secretAccessKey = secretAccessKeyEntry.plaintext();
56
61
  _s3CredentialsFromSecretStore = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "8.0.0-rc.1",
4
+ "version": "8.0.0-rc.2",
5
5
  "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "build/index.js",
7
7
  "exports": {