Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index with Algolia #7

Open
j4jefferson opened this issue Apr 21, 2022 · 0 comments
Open

Index with Algolia #7

j4jefferson opened this issue Apr 21, 2022 · 0 comments

Comments

@j4jefferson
Copy link

In lesson 06/05 'Securely Handle Algolia API key', I received an error:

"errorMessage": "Invalid value \"undefined\" for header \"x-algolia-api-key\"",
"code": "ERR_HTTP_INVALID_HEADER_VALUE",

I checked the @middy/ssm docs and changed the ssm middleware implementation in functions/sync-users-to-algolia.js to:

.use(
	ssm({
		cache: true,
		cacheExpiry: 5 * 60 * 1000,
		fetchData: {
			ALGOLIA_APP_ID: `/${STAGE}/algolia-app-id`,
			ALGOLIA_WRITE_KEY: `/${STAGE}/algolia-admin-key`,
		},
		setToContext: true,
		throwOnFailedCall: true,
	})
)

This resolved the error from the Lambda function and successfully got data into the Algolia index.
Dependencies are:
"@middy/core": "^2.5.7",
"@middy/ssm": "^2.5.7",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant