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

fix: make load context async again #10

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
run: yarn install --immutable --immutable-cache --check-cache
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Setup git user
run: |
git config --global user.email ${{ vars.GANDALF_EMAIL }}
git config --global user.name ${{ vars.GANDALF_NAME }}
- name: Semantic release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
Expand Down
13 changes: 3 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# 1.0.0 (2024-01-11)


### Bug Fixes

* **deps:** upgrade node dependencies 73e74c2
* **remix-adapter:** update jsdocs and types da375a7

- **deps:** upgrade node dependencies 73e74c2
- **remix-adapter:** update jsdocs and types da375a7

### Features

* **adapter:** implement remix.run azure adapter 1cdaa77
* **create-remix-azure-adapter:** support asynchronous getLoadContext f1503b3
* **create-remix-azure-adapter:** support asynchronous getLoadContext 90da3a2
* **packages:** add the create-remix-azure-adapter package ([#58](https://github.com/scandinavianairlines/remix-azure-functions/issues/58)) 033c5ce
* **rename:** remove 'adg' prefix from package name c197b97
* **types:** generate types on pre-publish 6ea55aa
- **adapter:** implement remix.run azure adapter 1cdaa77
4 changes: 2 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isBinaryType } from './is-binary-type.js';
installGlobals();

/**
* @typedef {(request: import('@azure/functions').HttpRequest, context: import('@azure/functions').InvocationContext) => import('@remix-run/node').AppLoadContext} GetLoadContextFn
* @typedef {(request: import('@azure/functions').HttpRequest, context: import('@azure/functions').InvocationContext) => Promise<import('@remix-run/node').AppLoadContext>} GetLoadContextFn
*/

/**
Expand Down Expand Up @@ -98,7 +98,7 @@ export function createRequestHandler(options) {
* @returns {Promise<import('@azure/functions').HttpResponseInit>} A Azure Function `http response init` object.
*/
async function functionHandler(request, context) {
const loadContext = options.getLoadContext?.(request, context);
const loadContext = await options.getLoadContext?.(request, context);
const remixRequest = createRemixRequest(request, { urlParser: options.urlParser });
const remixResponse = await handler(remixRequest, loadContext);

Expand Down
2 changes: 1 addition & 1 deletion src/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('server', () => {
params: undefined,
url: 'https://test.com',
});
const mockGetLoadContext = vi.fn();
const mockGetLoadContext = vi.fn().mockResolvedValue({});
const mockAzureContext = { log: vi.fn() };
createRemixRequestHandler.mockReturnValue(mockHandler);
const handler = createRequestHandler({
Expand Down
Loading