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

qe-wasm: Partially fix tests #4517

Merged
merged 2 commits into from
Dec 6, 2023
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
21 changes: 4 additions & 17 deletions query-engine/query-engine-wasm/build.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#!/bin/bash

set -e

# Call this script as `./build.sh <npm_version>`
set -euo pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


OUT_VERSION="$1"
OUT_VERSION="${1:-}"
OUT_FOLDER="pkg"
OUT_JSON="${OUT_FOLDER}/package.json"
OUT_TARGET="bundler"
OUT_NPM_NAME="@prisma/query-engine-wasm"

# The local ./Cargo.toml file uses "name = "query_engine_wasm" as library name
# to avoid conflicts with libquery's `name = "query_engine"` library name declaration.
# This little `sed -i` trick below is a hack to publish "@prisma/query-engine-wasm"
# with the same binding filenames currently expected by the Prisma Client.
sed -i.bak 's/name = "query_engine_wasm"/name = "query_engine"/g' Cargo.toml

# use `wasm-pack build --release` on CI only
if [[ -z "$BUILDKITE" ]] && [[ -z "$GITHUB_ACTIONS" ]]; then
if [[ -z "${BUILDKITE:-}" ]] && [[ -z "${GITHUB_ACTIONS:-}" ]]; then
BUILD_PROFILE="--dev"
else
BUILD_PROFILE="--release"
Expand All @@ -31,14 +25,7 @@ then
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
fi

wasm-pack build $BUILD_PROFILE --target $OUT_TARGET

sed -i.bak 's/name = "query_engine"/name = "query_engine_wasm"/g' Cargo.toml

# Remove the backup file created by sed. We only created it because there's no
# cross-platform way to specify we don't need one (it's just `-i` in GNU sed
# but `-i ""` in BSD sed).
rm Cargo.toml.bak
wasm-pack build $BUILD_PROFILE --target $OUT_TARGET --out-name query_engine

sleep 1

Expand Down
4 changes: 2 additions & 2 deletions query-engine/query-engine-wasm/example/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ datasource db {
}

generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
provider = "prisma-client-js"
previewFeatures = ["driverAdapters", "tracing"]
}

model User {
Expand Down
4 changes: 2 additions & 2 deletions query-engine/query-engine-wasm/src/wasm/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
};
use driver_adapters::JsObject;
use js_sys::Function as JsFunction;
use psl::PreviewFeature;
use query_core::{
protocol::EngineProtocol,
schema::{self, QuerySchema},
Expand Down Expand Up @@ -180,7 +179,8 @@ impl QueryEngine {
.validate_that_one_datasource_is_provided()
.map_err(|errors| ApiError::conversion(errors, schema.db.source()))?;

let enable_tracing = config.preview_features().contains(PreviewFeature::Tracing);
// Telemetry panics on timings if preview feature is enabled
let enable_tracing = false; // config.preview_features().contains(PreviewFeature::Tracing);
SevInf marked this conversation as resolved.
Show resolved Hide resolved
let engine_protocol = engine_protocol.unwrap_or(EngineProtocol::Json);

let builder = EngineBuilder {
Expand Down
Loading